switchboard-router 0.6.15 → 0.6.17

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 (323) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +7 -7
  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/agent-library/page.js.nft.json +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +2 -2
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  61. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  62. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  63. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  64. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  65. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  66. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  67. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  68. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  69. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  72. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  73. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  74. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  75. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
  76. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  77. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  78. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  79. package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
  80. package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
  83. package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
  85. package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
  87. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  89. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +4 -4
  91. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  93. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +1 -2
  96. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  98. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  100. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  102. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  108. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  110. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +3 -3
  112. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
  114. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +3 -3
  116. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  118. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  120. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  124. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  126. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  248. package/app/.next-cli-build/server/app/callback.html +1 -1
  249. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  250. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  251. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  252. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
  253. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  254. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  255. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  256. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  258. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  259. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  260. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  261. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  262. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  263. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  264. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  265. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  266. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  267. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  268. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/index.html +1 -1
  270. package/app/.next-cli-build/server/app/index.rsc +3 -3
  271. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  272. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  273. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  274. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
  275. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  276. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  278. package/app/.next-cli-build/server/app/landing.html +1 -1
  279. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  280. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  281. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  282. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
  283. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  284. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  285. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  286. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  288. package/app/.next-cli-build/server/app/login.html +1 -1
  289. package/app/.next-cli-build/server/app/login.rsc +3 -3
  290. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  291. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  292. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
  293. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  294. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  295. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  296. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  299. package/app/.next-cli-build/server/app-paths-manifest.json +7 -7
  300. package/app/.next-cli-build/server/chunks/194.js +1 -1
  301. package/app/.next-cli-build/server/chunks/{5115.js → 302.js} +11 -11
  302. package/app/.next-cli-build/server/chunks/4126.js +1 -1
  303. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  304. package/app/.next-cli-build/server/chunks/4776.js +2 -2
  305. package/app/.next-cli-build/server/chunks/5821.js +1 -1
  306. package/app/.next-cli-build/server/chunks/869.js +1 -1
  307. package/app/.next-cli-build/server/chunks/8998.js +1 -1
  308. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  309. package/app/.next-cli-build/server/pages/404.html +1 -1
  310. package/app/.next-cli-build/server/pages/500.html +1 -1
  311. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  312. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  313. package/app/.next-cli-build/static/chunks/{1321-941975a3154c23e5.js → 1321-d8d18be17b00c63b.js} +1 -1
  314. package/app/.next-cli-build/static/chunks/{2493-6241eb181f2ecb6e.js → 8798-6bf356da6c4b24bc.js} +16 -16
  315. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-9aa986f145130c08.js → page-b94c0e5365f146bc.js} +1 -1
  316. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-a09d7692b3ea9179.js → page-9849d434ab8fe899.js} +1 -1
  317. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-8619928e4b74f46b.js → page-f3bcbc25bb1b8ed3.js} +1 -1
  318. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-4ca7fef1bfee740a.js +10 -0
  319. package/app/package.json +1 -1
  320. package/package.json +1 -1
  321. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-1242ee346513608b.js +0 -10
  322. /package/app/.next-cli-build/static/{_3QZ47oq1giiHkNB7shrR → BPyHY8r6-2Gdq06Aqcl6N}/_buildManifest.js +0 -0
  323. /package/app/.next-cli-build/static/{_3QZ47oq1giiHkNB7shrR → BPyHY8r6-2Gdq06Aqcl6N}/_ssgManifest.js +0 -0
@@ -1,4 +1,13 @@
1
- "use strict";exports.id=5115,exports.ids=[5115],exports.modules={36811:a=>{a.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"]}}},43338:(a,b,c)=>{c.d(b,{qn:()=>O,Tk:()=>s,aG:()=>F,Ah:()=>t,Q6:()=>E,lF:()=>I,a7:()=>B,ZM:()=>v,Ib:()=>P,wg:()=>M,RF:()=>z,mW:()=>J,c9:()=>G,gY:()=>W,tA:()=>R,kn:()=>T,yZ:()=>x,qO:()=>C,S3:()=>N});var d=c(48249),e=c(67484),f=c(50412),g=c(81220),h=c(12020);let i="__custom__",j="__save__",k=a=>{};function l({value:a,onChange:b,requiresExternalUrl:c=!1,tunnelEnabled:f=!1,tunnelPublicUrl:g="",tailscaleEnabled:m=!1,tailscaleUrl:n="",cloudEnabled:o=!1,cloudUrl:p="",withV1:q=!0}){let[r,s]=(0,e.useState)([]),[t,u]=(0,e.useState)(""),[v,w]=(0,e.useState)("");(0,e.useRef)(!1);let x=(0,e.useMemo)(()=>(({requiresExternalUrl:a,savedPresets:b,withV1:c})=>{var d;let e,f=[],g=(d=`http://127.0.0.1:${h.h0.appPort}`,c?(e=(d||"").replace(/\/+$/,""))?/\/v1$/.test(e)?e:`${e}/v1`:"":(d||"").replace(/\/+$/,""));return f.push({value:"local",label:g,url:g}),b.forEach(a=>{f.push({value:`saved:${a.name}`,label:a.baseUrl,url:a.baseUrl,saved:!0})}),f.push({value:i,label:"Custom URL...",url:""}),f})({requiresExternalUrl:c,savedPresets:r,withV1:q}),[c,r,q]),y=t.startsWith("saved:"),z=t===i,A=z&&(v||"").trim().length>0;return(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("select",{value:t,onChange:c=>{let d=c.target.value;if(d===j){let b=(a||"").trim();if(!b)return;let c=b;try{c=new URL(b).host}catch{}let d=window.prompt("Save endpoint as:",c);if(!d?.trim())return;let e=[...r.filter(a=>a.name!==d.trim()),{name:d.trim(),baseUrl:b}].sort((a,b)=>a.name.localeCompare(b.name));s(e),k(e);return}if(u(d),d===i){w(""),b("");return}let e=x.find(a=>a.value===d);e&&b(e.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:[x.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value)),A&&(0,d.jsx)("option",{value:j,children:"+ Save current as..."})]}),y&&(0,d.jsx)("button",{type:"button",onClick:()=>{if(!t.startsWith("saved:"))return;let a=t.slice(6),c=r.filter(b=>b.name!==a);s(c),k(c),u(i),w(""),b("")},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),z&&(0,d.jsx)("input",{type:"text",value:v,onChange:a=>{let c=a.target.value;w(c),b(c)},placeholder:q?"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 m="__custom__";function n({value:a,onChange:b,apiKeys:c=[],cloudEnabled:f=!1,className:g=""}){let h=!c.some(b=>b.key===a)&&""!==a,[i,j]=(0,e.useState)(()=>a?c.some(b=>b.key===a)?a:m:c.length>0?c[0].key:m),[k,l]=(0,e.useState)(h?a:"");return 0===c.length&&i!==m&&i!==m?(0,d.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${g}`,children:f?"No API keys - Create one in Keys page":"sk_switchboard (default)"}):(0,d.jsxs)("div",{className:`flex flex-col gap-1.5 ${g}`,children:[(0,d.jsxs)("select",{value:i,onChange:a=>{let c=a.target.value;j(c),c===m?(l(""),b("")):b(c)},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:[c.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id)),(0,d.jsx)("option",{value:m,children:"Custom..."})]}),i===m&&(0,d.jsx)("input",{type:"text",value:k,onChange:a=>{let c=a.target.value;l(c),b(c)},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 o=a=>(a||"").replace(/\/+$/,"");function p(a,b={}){if(!a)return!1;let c=o(a),{tunnelPublicUrl:d,tailscaleUrl:e,cloudUrl:f}=b;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(c)||d&&c.startsWith(o(d))||e&&c.startsWith(o(e))||f&&c.startsWith(o(f)))}var q=c(6297);let r=process.env.NEXT_PUBLIC_CLOUD_URL;function s({tool:a,isExpanded:b,onToggle:c,activeProviders:h,modelMappings:i,onModelMappingChange:j,baseUrl:k,hasActiveProviders:m,apiKeys:o,cloudEnabled:q,initialStatus:t,tunnelEnabled:u,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:x}){let y,z,A,[B,C]=(0,e.useState)(t||null),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(null),[R,S]=(0,e.useState)(""),[T,U]=(0,e.useState)({}),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(""),[Z,$]=(0,e.useState)(!1);(0,e.useRef)(!1);let _=(()=>{if(!B?.installed)return null;let a=B.settings?.env?.ANTHROPIC_BASE_URL;return a?p(a,{tunnelPublicUrl:v,tailscaleUrl:x,cloudUrl:q?r:null})?"configured":"other":"not_configured"})(),aa=async a=>{let b=a.target.checked;$(b),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:b})}).catch(()=>{})},ab=()=>{let a=X||k;return a.endsWith("/v1")?a:`${a}/v1`},ac=async()=>{G(!0),K(null);try{let b={ANTHROPIC_BASE_URL:ab(),CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:"1"},c=R?.trim()||(o?.length>0?o[0].key:null)||(q?null:"sk_switchboard");c&&(b.ANTHROPIC_AUTH_TOKEN=c),a.defaultModels.forEach(a=>{let c=i[a.alias];c&&a.envKey&&(b[a.envKey]=c)});let d=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:b})}),e=await d.json();d.ok?(K({type:"success",text:"Settings applied successfully!"}),C(a=>({...a,hasBackup:!0,settings:{...a?.settings,env:b}}))):K({type:"error",text:e.error||"Failed to apply settings"})}catch(a){K({type:"error",text:a.message})}finally{G(!1)}},ad=async()=>{I(!0),K(null);try{let b=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),c=await b.json();b.ok?(K({type:"success",text:"Settings reset successfully!"}),a.defaultModels.forEach(a=>j(a.alias,a.defaultValue||"")),S("")):K({type:"error",text:c.error||"Failed to reset settings"})}catch(a){K({type:"error",text:a.message})}finally{I(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/claude.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===_&&(0,d.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"===_&&(0,d.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"===_&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[D&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude CLI..."})]}),!D&&B&&!B.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if switchboard is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>M(!L),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:L?"expand_less":"help"}),L?"Hide":"How to Install"]})]})]}),L&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!D&&B?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(l,{value:X||((y=X||k).endsWith("/v1")?y:`${y}/v1`),onChange:Y,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:u,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:x})]}),B?.settings?.env?.ANTHROPIC_BASE_URL&&(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.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:B.settings.env.ANTHROPIC_BASE_URL})]}),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(n,{value:R,onChange:S,apiKeys:o,cloudEnabled:q})]}),a.defaultModels.map(a=>(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:i[a.alias]||"",onChange:b=>j(a.alias,b.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"}),i[a.alias]&&(0,d.jsx)("button",{onClick:()=>j(a.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>{Q(a.alias),O(!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"})]},a.alias)),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,d.jsx)("input",{type:"checkbox",checked:Z,onChange:aa,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"}),(0,d.jsx)(f.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]})]}),J&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===J.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===J.type?"check_circle":"error"}),(0,d.jsx)("span",{children:J.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ac,disabled:!m,loading:F,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:ad,disabled:!B?.hasSwitchboard,loading:H,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>W(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:N,onClose:()=>O(!1),onSelect:a=>{P&&j(P,a.value)},selectedModel:P?i[P]:null,activeProviders:h,modelAliases:T,title:`Select model for ${P}`}),(0,d.jsx)(f.uR,{isOpen:V,onClose:()=>W(!1),title:"Claude CLI - Manual Configuration",configs:(z=R&&R.trim()?R:q?"<API_KEY_FROM_DASHBOARD>":"sk_switchboard",A={ANTHROPIC_BASE_URL:ab(),ANTHROPIC_AUTH_TOKEN:z,CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:"1"},a.defaultModels.forEach(a=>{let b=i[a.alias];b&&a.envKey&&(A[a.envKey]=b)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:A},null,2)}])})]})}function t({tool:a,isExpanded:b,onToggle:c,baseUrl:h,apiKeys:i,activeProviders:j,cloudEnabled:k,initialStatus:m,tunnelEnabled:o,tunnelPublicUrl:q,tailscaleEnabled:r,tailscaleUrl:s}){let u,v,w,x,[y,z]=(0,e.useState)(m||null),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(""),[O,P]=(0,e.useState)(""),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)({}),[W,X]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(""),$=(()=>{if(!y?.installed)return null;if(!y.config)return"not_configured";let a=y.config.match(/base_url\s*=\s*"([^"]+)"/);return p(a?a[1]:"",{tunnelPublicUrl:q,tailscaleUrl:s})?"configured":"other"})(),_=()=>{let a=Y||`${h}/v1`;return a.endsWith("/v1")?a:`${a}/v1`},aa=async()=>{B(!0);try{let a=await fetch("/api/cli-tools/codex-settings"),b=await a.json();z(b)}catch(a){z({installed:!1,error:a.message})}finally{B(!1)}},ab=async()=>{D(!0),H(null);try{let a=K&&K.trim()||k?K:"sk_switchboard",b=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:_(),apiKey:a,model:M,subagentModel:O||M})}),c=await b.json();b.ok?(H({type:"success",text:"Settings applied successfully!"}),aa()):H({type:"error",text:c.error||"Failed to apply settings"})}catch(a){H({type:"error",text:a.message})}finally{D(!1)}},ac=async()=>{F(!0),H(null);try{let a=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),b=await a.json();a.ok?(H({type:"success",text:"Settings reset successfully!"}),N(""),P(""),aa()):H({type:"error",text:b.error||"Failed to reset settings"})}catch(a){H({type:"error",text:a.message})}finally{F(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/codex.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===$&&(0,d.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"===$&&(0,d.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"===$&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[A&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Codex CLI..."})]}),!A&&y&&!y.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if switchboard is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>X(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>J(!I),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:I?"expand_less":"help"}),I?"Hide":"How to Install"]})]})]}),I&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,d.jsx)("div",{className:"pt-2 border-t border-border",children:(0,d.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!A&&y?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(l,{value:Y||Y||`${h}/v1`,onChange:Z,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:o,tunnelPublicUrl:q,tailscaleEnabled:r,tailscaleUrl:s})]}),y?.config&&((v=(u=y.config.match(/base_url\s*=\s*"([^"]+)"/))?u[1]:null)?(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.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:v})]}):null),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(n,{value:K,onChange:L,apiKeys:i,cloudEnabled:k})]}),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:M,onChange:a=>N(a.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"}),M&&(0,d.jsx)("button",{onClick:()=>N(""),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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>R(!0),disabled:!j?.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 ${j?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:O,onChange:a=>P(a.target.value),placeholder:M||"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"}),O&&(0,d.jsx)("button",{onClick:()=>P(""),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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>T(!0),disabled:!j?.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 ${j?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),G&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===G.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===G.type?"check_circle":"error"}),(0,d.jsx)("span",{children:G.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ab,disabled:!K&&k&&i.length>0||!M,loading:C,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:ac,disabled:E,loading:E,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>X(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:Q,onClose:()=>R(!1),onSelect:a=>{N(a.value),O||P(a.value),R(!1)},selectedModel:M,activeProviders:j,modelAliases:U,title:"Select Model for Codex"}),(0,d.jsx)(f.rq,{isOpen:S,onClose:()=>T(!1),onSelect:a=>{P(a.value),T(!1)},selectedModel:O,activeProviders:j,modelAliases:U,title:"Select Subagent Model for Codex"}),(0,d.jsx)(f.uR,{isOpen:W,onClose:()=>X(!1),title:"Codex CLI - Manual Configuration",configs:(w=K&&K.trim()?K:k?"<API_KEY_FROM_DASHBOARD>":"sk_switchboard",x=O||M,[{filename:"~/.codex/config.toml",content:`# Switchboard Configuration for Codex CLI
1
+ "use strict";exports.id=302,exports.ids=[302],exports.modules={36811:a=>{a.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"]}}},62911:(a,b,c)=>{c.d(b,{dM:()=>e,wn:()=>d});let d={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:"q.us-east-1.amazonaws.com",defaultModels:[{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"}]}},e={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",fableModel:"ANTHROPIC_DEFAULT_FABLE_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","fable","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-8"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-5"},{id:"fable",name:"Claude Fable",alias:"fable",envKey:"ANTHROPIC_DEFAULT_FABLE_MODEL",defaultValue:"cc/claude-fable-5"},{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",modelSelection:"multiple",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:"Select Models",type:"modelSelector"},{step:6,title:"Add Custom Models",desc:"Click “View All Models” → “Add Custom Model” once for each selected model. The endpoint and API key are shared."}]},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",modelSelection:"multiple",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Models",type:"modelSelector"},{step:6,title:"Create Profiles",desc:"Create one named Switchboard API Configuration Profile per selected model; Roo stores one model per profile."}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",modelSelection:"multiple",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Models",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Merge the generated entries into ~/.continue/config.yaml."}],codeBlock:{language:"yaml",code:({baseUrl:a,apiKey:b,models:c})=>`name: Switchboard
2
+ version: 1.0.0
3
+ schema: v1
4
+ models:
5
+ ${c.map(c=>` - name: "Switchboard \xb7 ${c}"
6
+ provider: openai
7
+ model: "${c}"
8
+ apiBase: "${a}"
9
+ apiKey: "${b}"
10
+ roles: [chat, edit, apply]`).join("\n")}`}},qwen:{id:"qwen",name:"Qwen Code",image:"/providers/qwen.png",color:"#10B981",description:"Alibaba Qwen Code CLI — supports OpenAI, Anthropic & Gemini providers via Switchboard",docsUrl:"https://qwenlm.github.io/qwen-code-docs/en/users/configuration/model-providers/",configType:"guide",modelSelection:"multiple",defaultCommand:"qwen",notes:[{type:"info",text:"Qwen Code supports multiple provider types (openai, anthropic, gemini) via modelProviders in settings.json. Switchboard works as an OpenAI-compatible endpoint."},{type:"info",text:"Any model available in Switchboard can be used — not just Qwen models. Select from Qwen, Claude, Gemini, GPT, and more."},{type:"warning",text:"Config path: Linux/macOS ~/.qwen/settings.json • Windows %USERPROFILE%\\.qwen\\settings.json"},{type:"error",text:"Qwen OAuth free tier was discontinued on 2026-04-15. Use Switchboard with alicode/openrouter/anthropic/gemini providers instead."}],modelAliases:["coder-model","qwen3-coder-plus","qwen3-coder-flash","vision-model","claude-sonnet-4-6","claude-opus-4-6-thinking","gemini-3-flash","gemini-3.1-pro-high"],defaultModels:[{id:"coder-model",name:"Coder Model (Qwen 3.6 Plus)",alias:"coder-model",envKey:"OPENAI_MODEL",defaultValue:"coder-model",isTopLevel:!0},{id:"qwen3-coder-plus",name:"Qwen 3 Coder Plus",alias:"qwen3-coder-plus",envKey:"OPENAI_MODEL",defaultValue:"qwen3-coder-plus"},{id:"qwen3-coder-flash",name:"Qwen 3 Coder Flash",alias:"qwen3-coder-flash",envKey:"OPENAI_MODEL",defaultValue:"qwen3-coder-flash"},{id:"vision-model",name:"Vision Model (Multimodal)",alias:"vision-model",envKey:"OPENAI_MODEL",defaultValue:"vision-model"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6",envKey:"OPENAI_MODEL",defaultValue:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking",envKey:"OPENAI_MODEL",defaultValue:"claude-opus-4-6-thinking"},{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high",envKey:"OPENAI_MODEL",defaultValue:"gemini-3.1-pro-high"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash",envKey:"OPENAI_MODEL",defaultValue:"gemini-3-flash"}],guideSteps:[{step:1,title:"Install Qwen Code",desc:"npm install -g @qwen-code/qwen-code"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"Select Models",type:"modelSelector"},{step:5,title:"Save Config",desc:"Copy the JSON below to ~/.qwen/settings.json and export SWITCHBOARD_API_KEY in your shell."}],codeBlock:{language:"json",code:({baseUrl:a,models:b})=>JSON.stringify({modelProviders:{openai:{protocol:"openai",models:b.map(b=>({id:b,name:`Switchboard \xb7 ${b}`,baseUrl:a,envKey:"SWITCHBOARD_API_KEY"}))}}},null,2)}},"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/Hmbown/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. Switchboard 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 switchboard as an OpenAI-compatible provider to route all jcode requests through switchboard'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"}]},grok:{id:"grok",name:"Grok CLI",image:"/providers/xai.png",color:"#000000",description:"Open-source Grok terminal coding agent (grok-dev) via Switchboard",docsUrl:"https://github.com/superagent-ai/grok-cli",configType:"custom",defaultCommand:"grok",notes:[{type:"info",when:"installed",text:"Writes ~/.grok/user-settings.json (apiKey, defaultModel) and ~/.grok/switchboard.env (GROK_BASE_URL). Source the env file before launching grok — the CLI only reads base URL from the environment."},{type:"install",when:"not_installed",text:"Install: curl -fsSL https://raw.githubusercontent.com/superagent-ai/grok-cli/main/install.sh | bash \xb7 or bun add -g grok-dev"}],defaultModels:[{id:"xai/grok-4",name:"Grok 4",alias:"grok-4",defaultValue:"xai/grok-4"},{id:"xai/grok-3",name:"Grok 3",alias:"grok-3",defaultValue:"xai/grok-3"},{id:"xai/grok-3-mini",name:"Grok 3 Mini",alias:"grok-3-mini",defaultValue:"xai/grok-3-mini"}]},pi:{id:"pi",name:"Pi",image:"/providers/pi.svg",color:"#38BDF8",description:"Minimal terminal coding agent (pi.dev) with custom OpenAI-compatible provider",docsUrl:"https://pi.dev",configType:"custom",defaultCommand:"pi",notes:[{type:"info",when:"installed",text:"Adds a switchboard provider to ~/.pi/agent/models.json. In Pi use /model (Ctrl+L) and pick switchboard/<model-id>."},{type:"install",when:"not_installed",text:"Install: npm install -g --ignore-scripts @earendil-works/pi-coding-agent \xb7 or curl -fsSL https://pi.dev/install.sh | sh"}]},aider:{id:"aider",name:"Aider",image:"/providers/aider.svg",color:"#34D399",description:"AI pair programming in your terminal (OpenAI-compatible)",docsUrl:"https://aider.chat",configType:"custom",defaultCommand:"aider",notes:[{type:"info",when:"installed",text:"Writes ~/.aider.conf.yml with openai-api-base, openai-api-key, and model (openai/<id>)."},{type:"install",when:"not_installed",text:"Install: pipx install aider-chat \xb7 or python -m pip install aider-chat"}]},"gemini-cli":{id:"gemini-cli",name:"Gemini CLI",image:"/providers/gemini-cli.png",color:"#4285F4",description:"Google Gemini CLI pointed at Switchboard (OpenAI-compatible env)",docsUrl:"https://github.com/google-gemini/gemini-cli",configType:"custom",defaultCommand:"gemini",notes:[{type:"info",when:"installed",text:"Writes ~/.gemini/switchboard.env (OPENAI_* + GEMINI_*). Source it before running gemini so requests hit Switchboard."},{type:"install",when:"not_installed",text:"Install: npm install -g @google/gemini-cli"}]}}},65095:(a,b,c)=>{c.d(b,{qn:()=>O,Tk:()=>s,aG:()=>F,Ah:()=>t,Q6:()=>E,lF:()=>I,a7:()=>B,ZM:()=>v,Ib:()=>P,wg:()=>M,RF:()=>z,mW:()=>J,c9:()=>G,gY:()=>W,tA:()=>R,kn:()=>T,yZ:()=>x,qO:()=>C,S3:()=>N});var d=c(48249),e=c(67484),f=c(50412),g=c(81220),h=c(12020);let i="__custom__",j="__save__",k=a=>{};function l({value:a,onChange:b,requiresExternalUrl:c=!1,tunnelEnabled:f=!1,tunnelPublicUrl:g="",tailscaleEnabled:m=!1,tailscaleUrl:n="",cloudEnabled:o=!1,cloudUrl:p="",withV1:q=!0}){let[r,s]=(0,e.useState)([]),[t,u]=(0,e.useState)(""),[v,w]=(0,e.useState)("");(0,e.useRef)(!1);let x=(0,e.useMemo)(()=>(({requiresExternalUrl:a,savedPresets:b,withV1:c})=>{var d;let e,f=[],g=(d=`http://127.0.0.1:${h.h0.appPort}`,c?(e=(d||"").replace(/\/+$/,""))?/\/v1$/.test(e)?e:`${e}/v1`:"":(d||"").replace(/\/+$/,""));return f.push({value:"local",label:g,url:g}),b.forEach(a=>{f.push({value:`saved:${a.name}`,label:a.baseUrl,url:a.baseUrl,saved:!0})}),f.push({value:i,label:"Custom URL...",url:""}),f})({requiresExternalUrl:c,savedPresets:r,withV1:q}),[c,r,q]),y=t.startsWith("saved:"),z=t===i,A=z&&(v||"").trim().length>0;return(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("select",{value:t,onChange:c=>{let d=c.target.value;if(d===j){let b=(a||"").trim();if(!b)return;let c=b;try{c=new URL(b).host}catch{}let d=window.prompt("Save endpoint as:",c);if(!d?.trim())return;let e=[...r.filter(a=>a.name!==d.trim()),{name:d.trim(),baseUrl:b}].sort((a,b)=>a.name.localeCompare(b.name));s(e),k(e);return}if(u(d),d===i){w(""),b("");return}let e=x.find(a=>a.value===d);e&&b(e.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:[x.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value)),A&&(0,d.jsx)("option",{value:j,children:"+ Save current as..."})]}),y&&(0,d.jsx)("button",{type:"button",onClick:()=>{if(!t.startsWith("saved:"))return;let a=t.slice(6),c=r.filter(b=>b.name!==a);s(c),k(c),u(i),w(""),b("")},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors shrink-0",title:"Delete saved endpoint",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]}),z&&(0,d.jsx)("input",{type:"text",value:v,onChange:a=>{let c=a.target.value;w(c),b(c)},placeholder:q?"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 m="__custom__";function n({value:a,onChange:b,apiKeys:c=[],cloudEnabled:f=!1,className:g=""}){let h=!c.some(b=>b.key===a)&&""!==a,[i,j]=(0,e.useState)(()=>a?c.some(b=>b.key===a)?a:m:c.length>0?c[0].key:m),[k,l]=(0,e.useState)(h?a:"");return 0===c.length&&i!==m&&i!==m?(0,d.jsx)("span",{className:`min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5 ${g}`,children:f?"No API keys - Create one in Keys page":"sk_switchboard (default)"}):(0,d.jsxs)("div",{className:`flex flex-col gap-1.5 ${g}`,children:[(0,d.jsxs)("select",{value:i,onChange:a=>{let c=a.target.value;j(c),c===m?(l(""),b("")):b(c)},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:[c.map(a=>(0,d.jsx)("option",{value:a.key,children:a.key},a.id)),(0,d.jsx)("option",{value:m,children:"Custom..."})]}),i===m&&(0,d.jsx)("input",{type:"text",value:k,onChange:a=>{let c=a.target.value;l(c),b(c)},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 o=a=>(a||"").replace(/\/+$/,"");function p(a,b={}){if(!a)return!1;let c=o(a),{tunnelPublicUrl:d,tailscaleUrl:e,cloudUrl:f}=b;return!!(/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(c)||d&&c.startsWith(o(d))||e&&c.startsWith(o(e))||f&&c.startsWith(o(f)))}var q=c(6297);let r=process.env.NEXT_PUBLIC_CLOUD_URL;function s({tool:a,isExpanded:b,onToggle:c,activeProviders:h,modelMappings:i,onModelMappingChange:j,baseUrl:k,hasActiveProviders:m,apiKeys:o,cloudEnabled:q,initialStatus:t,tunnelEnabled:u,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:x}){let y,z,A,[B,C]=(0,e.useState)(t||null),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(null),[R,S]=(0,e.useState)(""),[T,U]=(0,e.useState)({}),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(""),[Z,$]=(0,e.useState)(!1);(0,e.useRef)(!1);let _=(()=>{if(!B?.installed)return null;let a=B.settings?.env?.ANTHROPIC_BASE_URL;return a?p(a,{tunnelPublicUrl:v,tailscaleUrl:x,cloudUrl:q?r:null})?"configured":"other":"not_configured"})(),aa=async a=>{let b=a.target.checked;$(b),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:b})}).catch(()=>{})},ab=async()=>{E(!0);try{let a=await fetch("/api/cli-tools/claude-settings"),b=await a.json();if(!a.ok)throw Error(b.error||"Failed to read Claude Code settings");return C(b),b}catch(a){throw C({installed:!1,error:a.message}),a}finally{E(!1)}},ac=()=>{let a=X||k;return a.endsWith("/v1")?a:`${a}/v1`},ad=async()=>{G(!0),K(null);try{let b={ANTHROPIC_BASE_URL:ac(),CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:"1"},c=R?.trim()||(o?.length>0?o[0].key:null)||(q?null:"sk_switchboard");c&&(b.ANTHROPIC_AUTH_TOKEN=c),a.defaultModels.forEach(a=>{let c=i[a.alias];c&&a.envKey&&(b[a.envKey]=c)});let d=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:b})}),e=await d.json();d.ok?(await ab(),K({type:"success",text:e.message||"Claude Code connected to Switchboard."})):K({type:"error",text:e.error||"Failed to apply settings"})}catch(a){K({type:"error",text:a.message})}finally{G(!1)}},ae=async()=>{I(!0),K(null);try{let d=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),e=await d.json();if(d.ok){var b,c;let d,f=await ab(),g=f.settings?.env||{},h=(b=a.defaultModels,c=f.settings,d=c?.env&&"object"==typeof c.env&&!Array.isArray(c.env)?c.env:{},Object.fromEntries(b.map(a=>[a.alias,a.envKey&&"string"==typeof d[a.envKey]?d[a.envKey]:""])));Object.entries(h).forEach(([a,b])=>j(a,b));let i=g.ANTHROPIC_AUTH_TOKEN;S(i&&o?.some(a=>a.key===i)?i:""),K({type:e.restored?"success":"warning",text:e.message||"Claude Code disconnected from Switchboard."})}else K({type:"error",text:e.error||"Failed to disconnect Claude Code"})}catch(a){K({type:"error",text:a.message})}finally{I(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/claude.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===_&&(0,d.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"===_&&(0,d.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"===_&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[D&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Claude CLI..."})]}),!D&&B&&!B.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if switchboard is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$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,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>M(!L),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:L?"expand_less":"help"}),L?"Hide":"How to Install"]})]})]}),L&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!D&&B?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(l,{value:X||((y=X||k).endsWith("/v1")?y:`${y}/v1`),onChange:Y,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:u,tunnelPublicUrl:v,tailscaleEnabled:w,tailscaleUrl:x})]}),B?.settings?.env?.ANTHROPIC_BASE_URL&&(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.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:B.settings.env.ANTHROPIC_BASE_URL})]}),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(n,{value:R,onChange:S,apiKeys:o,cloudEnabled:q})]}),a.defaultModels.map(a=>(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:i[a.alias]||"",onChange:b=>j(a.alias,b.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"}),i[a.alias]&&(0,d.jsx)("button",{type:"button",onClick:()=>j(a.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{type:"button",onClick:()=>{Q(a.alias),O(!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"})]},a.alias)),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,d.jsx)("input",{type:"checkbox",checked:Z,onChange:aa,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"}),(0,d.jsx)(f.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]})]}),J&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===J.type?"bg-green-500/10 text-green-600":"warning"===J.type?"bg-amber-500/10 text-amber-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===J.type?"check_circle":"warning"===J.type?"warning":"error"}),(0,d.jsx)("span",{children:J.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ad,disabled:!m,loading:F,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:ae,disabled:!B?.hasSwitchboard,loading:H,title:B?.hasBackup?"Restore the pre-Switchboard Claude Code settings":"Remove Switchboard settings from Claude Code",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"link_off"}),"Disconnect"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>W(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:N,onClose:()=>O(!1),onSelect:a=>{P&&j(P,a.value)},selectedModel:P?i[P]:null,activeProviders:h,modelAliases:T,title:`Select model for ${P}`}),(0,d.jsx)(f.uR,{isOpen:V,onClose:()=>W(!1),title:"Claude CLI - Manual Configuration",configs:(z=R&&R.trim()?R:q?"<API_KEY_FROM_DASHBOARD>":"sk_switchboard",A={ANTHROPIC_BASE_URL:ac(),ANTHROPIC_AUTH_TOKEN:z,CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:"1"},a.defaultModels.forEach(a=>{let b=i[a.alias];b&&a.envKey&&(A[a.envKey]=b)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:A},null,2)}])})]})}function t({tool:a,isExpanded:b,onToggle:c,baseUrl:h,apiKeys:i,activeProviders:j,cloudEnabled:k,initialStatus:m,tunnelEnabled:o,tunnelPublicUrl:q,tailscaleEnabled:r,tailscaleUrl:s}){let u,v,w,x,[y,z]=(0,e.useState)(m||null),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(""),[O,P]=(0,e.useState)(""),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)({}),[W,X]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(""),$=(()=>{if(!y?.installed)return null;if(!y.config)return"not_configured";let a=y.config.match(/base_url\s*=\s*"([^"]+)"/);return p(a?a[1]:"",{tunnelPublicUrl:q,tailscaleUrl:s})?"configured":"other"})(),_=()=>{let a=Y||`${h}/v1`;return a.endsWith("/v1")?a:`${a}/v1`},aa=async()=>{B(!0);try{let a=await fetch("/api/cli-tools/codex-settings"),b=await a.json();z(b)}catch(a){z({installed:!1,error:a.message})}finally{B(!1)}},ab=async()=>{D(!0),H(null);try{let a=K&&K.trim()||k?K:"sk_switchboard",b=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:_(),apiKey:a,model:M,subagentModel:O||M})}),c=await b.json();b.ok?(H({type:"success",text:"Settings applied successfully!"}),aa()):H({type:"error",text:c.error||"Failed to apply settings"})}catch(a){H({type:"error",text:a.message})}finally{D(!1)}},ac=async()=>{F(!0),H(null);try{let a=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),b=await a.json();a.ok?(H({type:"success",text:"Settings reset successfully!"}),N(""),P(""),aa()):H({type:"error",text:b.error||"Failed to reset settings"})}catch(a){H({type:"error",text:a.message})}finally{F(!1)}};return(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:"/providers/codex.png",alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),"configured"===$&&(0,d.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"===$&&(0,d.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"===$&&(0,d.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,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[A&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{children:"Checking Codex CLI..."})]}),!A&&y&&!y.installed&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if switchboard is deployed on a remote server."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,d.jsxs)(f.$n,{variant:"secondary",size:"sm",onClick:()=>X(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:()=>J(!I),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:I?"expand_less":"help"}),I?"Hide":"How to Install"]})]})]}),I&&(0,d.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,d.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,d.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,d.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,d.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,d.jsx)("div",{className:"pt-2 border-t border-border",children:(0,d.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,d.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!A&&y?.installed&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Select Endpoint"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(l,{value:Y||Y||`${h}/v1`,onChange:Z,requiresExternalUrl:a.requiresExternalUrl,tunnelEnabled:o,tunnelPublicUrl:q,tailscaleEnabled:r,tailscaleUrl:s})]}),y?.config&&((v=(u=y.config.match(/base_url\s*=\s*"([^"]+)"/))?u[1]:null)?(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.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:v})]}):null),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)(n,{value:K,onChange:L,apiKeys:i,cloudEnabled:k})]}),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:M,onChange:a=>N(a.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"}),M&&(0,d.jsx)("button",{onClick:()=>N(""),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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>R(!0),disabled:!j?.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 ${j?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,d.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,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:O,onChange:a=>P(a.target.value),placeholder:M||"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"}),O&&(0,d.jsx)("button",{onClick:()=>P(""),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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>T(!0),disabled:!j?.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 ${j?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),G&&(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===G.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===G.type?"check_circle":"error"}),(0,d.jsx)("span",{children:G.text})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsxs)(f.$n,{variant:"primary",size:"sm",onClick:ab,disabled:!K&&k&&i.length>0||!M,loading:C,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,d.jsxs)(f.$n,{variant:"outline",size:"sm",onClick:ac,disabled:E,loading:E,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,d.jsxs)(f.$n,{variant:"ghost",size:"sm",onClick:()=>X(!0),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,d.jsx)(f.rq,{isOpen:Q,onClose:()=>R(!1),onSelect:a=>{N(a.value),O||P(a.value),R(!1)},selectedModel:M,activeProviders:j,modelAliases:U,title:"Select Model for Codex"}),(0,d.jsx)(f.rq,{isOpen:S,onClose:()=>T(!1),onSelect:a=>{P(a.value),T(!1)},selectedModel:O,activeProviders:j,modelAliases:U,title:"Select Subagent Model for Codex"}),(0,d.jsx)(f.uR,{isOpen:W,onClose:()=>X(!1),title:"Codex CLI - Manual Configuration",configs:(w=K&&K.trim()?K:k?"<API_KEY_FROM_DASHBOARD>":"sk_switchboard",x=O||M,[{filename:"~/.codex/config.toml",content:`# Switchboard Configuration for Codex CLI
2
11
  model = "${M}"
3
12
  model_provider = "switchboard"
4
13
 
@@ -55,13 +64,4 @@ ${f}
55
64
  export GEMINI_API_KEY="${b}"
56
65
  export GEMINI_MODEL="${c}"
57
66
  export GOOGLE_GEMINI_BASE_URL="${a.replace(/\/v1$/,"")}"
58
- `},{filename:"~/.gemini/settings.json",content:JSON.stringify({model:{name:c},experimental:{dynamicModelConfiguration:!0},modelConfigs:{modelDefinitions:Object.fromEntries(d.map(a=>[a,{displayName:`Switchboard \xb7 ${a.split("/").pop()||a}`,family:"switchboard",tier:"custom",isPreview:!1,isVisible:!0,features:{thinking:!0,multimodalToolUse:!0}}]))}},null,2)}]})}let Q="http://localhost:20128";function R({apiKeys:a,cloudEnabled:b,onStatusChange:c}){let[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(()=>a?.[0]?.key||""),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(Q),[y,z]=(0,e.useState)(null),A=g?.isWin===!0,B=A||g?.hasCachedPassword||g?.needsSudoPassword===!1,C=g?.isAdmin!==!1;!C&&(A||g?.hasCachedPassword||g?.needsSudoPassword);let D=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/cli-tools/antigravity-mitm");if(a.ok){let b=await a.json();h(b),b.mitmRouterBaseUrl&&x(b.mitmRouterBaseUrl),c?.(b)}}catch{h({running:!1,certExists:!1,dnsStatus:{}})}},[c]),E=a=>{v(null),g&&(B?F(a,""):(r(a),l(!0),t(null)))},F=async(c,d,e=!1)=>{j(!0),v(null);try{let f;if("trust-cert"===c)f=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:d})});else if("start"===c){let c=o?.trim()||(a?.length>0?a[0].key:null)||(b?null:"sk_switchboard");f=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,sudoPassword:d,mitmRouterBaseUrl:w.trim()||Q,forceKillPort443:e})})}else f=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:d})});if(!f.ok){let a=await f.json().catch(()=>({}));if("PORT_443_BUSY"===a.code&&a.portOwner){l(!1),z({owner:a.portOwner,password:d});return}v(a.error||`Failed to ${c} MITM server`);return}l(!1),n(""),z(null),await D()}catch(a){v(a.message||"Network error")}finally{j(!1),r(null)}},G=()=>{m.trim()?F(q,m):t("Sudo password is required")},H=g?.running;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),H?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Running"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:g?.certExists},{label:"Trusted",ok:g?.certTrusted},{label:"Server",ok:H}].map(({label:a,ok:b})=>(0,d.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${b?"text-green-600":"text-text-muted"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:b?"check_circle":"cancel"}),a]},a))})]}),(0,d.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from Switchboard"]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → Switchboard → response to Antigravity/Copilot"]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Switchboard Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:w,onChange:a=>x(a.target.value),placeholder:Q,disabled:H,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!H&&(0,d.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",list:"mitm-api-keys",value:o,onChange:a=>p(a.target.value),placeholder:b?"Enter or pick API key":"sk_switchboard (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),a?.length>0&&(0,d.jsx)("datalist",{id:"mitm-api-keys",children:a.map(a=>(0,d.jsx)("option",{value:a.key,children:a.name||a.key},a.id))})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center","data-i18n-skip":"true",children:[g?.certExists&&!g?.certTrusted&&(0,d.jsxs)("button",{onClick:()=>E("trust-cert"),disabled:i,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-2 text-xs font-medium text-yellow-600 transition-colors hover:bg-yellow-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),H?(0,d.jsxs)("button",{onClick:()=>E("stop"),disabled:i,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,d.jsxs)("button",{onClick:()=>E("start"),disabled:i||!g||A&&!C,title:A&&!C?"Administrator required":void 0,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),H&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),u&&(0,d.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,d.jsx)("span",{children:u})]}),A&&!C&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,d.jsx)("span",{children:"Administrator required — restart Switchboard as Administrator to use MITM"})]})]})}),k&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:a=>n(a.target.value),onKeyDown:a=>{"Enter"!==a.key||i||G()}}),s&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:s})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{l(!1),n(""),t(null)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:G,loading:i,children:"Confirm"})]})]})}),y&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Port 443 Already In Use"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 text-xs text-text-muted",children:[(0,d.jsx)("p",{children:"Port 443 is currently used by another process:"}),(0,d.jsxs)("p",{className:"font-mono text-text-main","data-i18n-skip":"true",children:[y.owner.name," (PID ",y.owner.pid,")"]}),(0,d.jsx)("p",{children:"Kill this process to start MITM Server?"})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{z(null),j(!1)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:()=>{F("start",y?.password||"",!0)},loading:i,children:"Kill & Start"})]})]})})]})}var S=c(36811);function T({tool:a,isExpanded:b,onToggle:c,serverRunning:h,dnsActive:i,hasCachedPassword:j,needsSudoPassword:k,isWin:l,apiKeys:m,activeProviders:n,hasActiveProviders:o,modelAliases:p={},cloudEnabled:q,onDnsChange:r}){let[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)({}),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(null),K=S.TOOL_HOSTS[a.id]??[],L=l||j||!1===k;(0,e.useCallback)(async()=>{try{let b=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${a.id}`);if(b.ok){let a=await b.json();Object.keys(a.aliases||{}).length>0&&F(a.aliases)}}catch{}},[a.id]);let M=(0,e.useCallback)(async b=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,mappings:b})})}catch{}},[a.id]),N=(a,b)=>{F(c=>({...c,[a]:b}))},O=()=>{if(!h)return;let a=i?"disable":"enable";L?P(a,""):(B(a),x(!0),D(null))},P=async(b,c)=>{t(!0),v(null);try{let d=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,action:b,sudoPassword:c})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to toggle DNS");"enable"===b&&v(`Restart ${a.name} to apply changes`),x(!1),z(""),r?.(e)}catch{}finally{t(!1),B(null)}},Q=()=>{y.trim()?P(A,y):D("Sudo password is required")};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),h?i?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Active"}):(0,d.jsx)(f.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted sm:truncate",children:["Intercept ",a.name," requests via MITM proxy"]})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[K.length>0&&(0,d.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,d.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:K.map(a=>(0,d.jsxs)("li",{children:["127.0.0.1 ",a]},a))})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,d.jsxs)("p",{children:["Toggle DNS to redirect ",a.name," traffic through Switchboard via MITM."]}),!i&&(0,d.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),a.defaultModels?.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.defaultModels.map(a=>(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[9rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:E[a.alias]||"",onChange:b=>N(a.alias,b.target.value),onBlur:b=>{var c,d;return c=a.alias,d=b.target.value,void M({...E,[c]:d})},placeholder:"provider/model-id",disabled:!i,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 ${!i?"opacity-50 cursor-not-allowed":""}`}),E[a.alias]&&(0,d.jsx)("button",{onClick:()=>{N(a.alias,""),M({...E,[a.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>{J(a.alias),H(!0)},disabled:!o||!i,className:`rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 ${o&&i?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},a.alias))}),a.defaultModels?.length===0&&(0,d.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:items-start",children:[i?(0,d.jsxs)("button",{onClick:O,disabled:!h||s,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,d.jsxs)("button",{onClick:O,disabled:!h||s,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,d.jsx)("span",{children:u})]})]})]})]}),w&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:y,onChange:a=>z(a.target.value),onKeyDown:a=>{"Enter"!==a.key||s||Q()}}),C&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:C})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),z(""),D(null)},disabled:s,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:Q,loading:s,children:"Confirm"})]})]})}),(0,d.jsx)(f.rq,{isOpen:G,onClose:()=>H(!1),onSelect:a=>{if(!I||a.isPlaceholder)return;let b={...E,[I]:a.value};F(b),M(b)},selectedModel:I?E[I]:null,activeProviders:n,modelAliases:p,title:`Select model for ${I}`})]})}var U=c(2116),V=c.n(U);function W({tool:a}){return(0,d.jsx)(V(),{href:"/dashboard/mitm",className:"block",children:(0,d.jsx)(f.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},62911:(a,b,c)=>{c.d(b,{dM:()=>e,wn:()=>d});let d={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:"q.us-east-1.amazonaws.com",defaultModels:[{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"}]}},e={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",fableModel:"ANTHROPIC_DEFAULT_FABLE_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","fable","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-8"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-5"},{id:"fable",name:"Claude Fable",alias:"fable",envKey:"ANTHROPIC_DEFAULT_FABLE_MODEL",defaultValue:"cc/claude-fable-5"},{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",modelSelection:"multiple",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:"Select Models",type:"modelSelector"},{step:6,title:"Add Custom Models",desc:"Click “View All Models” → “Add Custom Model” once for each selected model. The endpoint and API key are shared."}]},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",modelSelection:"multiple",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Models",type:"modelSelector"},{step:6,title:"Create Profiles",desc:"Create one named Switchboard API Configuration Profile per selected model; Roo stores one model per profile."}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",modelSelection:"multiple",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Models",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Merge the generated entries into ~/.continue/config.yaml."}],codeBlock:{language:"yaml",code:({baseUrl:a,apiKey:b,models:c})=>`name: Switchboard
59
- version: 1.0.0
60
- schema: v1
61
- models:
62
- ${c.map(c=>` - name: "Switchboard \xb7 ${c}"
63
- provider: openai
64
- model: "${c}"
65
- apiBase: "${a}"
66
- apiKey: "${b}"
67
- roles: [chat, edit, apply]`).join("\n")}`}},qwen:{id:"qwen",name:"Qwen Code",image:"/providers/qwen.png",color:"#10B981",description:"Alibaba Qwen Code CLI — supports OpenAI, Anthropic & Gemini providers via Switchboard",docsUrl:"https://qwenlm.github.io/qwen-code-docs/en/users/configuration/model-providers/",configType:"guide",modelSelection:"multiple",defaultCommand:"qwen",notes:[{type:"info",text:"Qwen Code supports multiple provider types (openai, anthropic, gemini) via modelProviders in settings.json. Switchboard works as an OpenAI-compatible endpoint."},{type:"info",text:"Any model available in Switchboard can be used — not just Qwen models. Select from Qwen, Claude, Gemini, GPT, and more."},{type:"warning",text:"Config path: Linux/macOS ~/.qwen/settings.json • Windows %USERPROFILE%\\.qwen\\settings.json"},{type:"error",text:"Qwen OAuth free tier was discontinued on 2026-04-15. Use Switchboard with alicode/openrouter/anthropic/gemini providers instead."}],modelAliases:["coder-model","qwen3-coder-plus","qwen3-coder-flash","vision-model","claude-sonnet-4-6","claude-opus-4-6-thinking","gemini-3-flash","gemini-3.1-pro-high"],defaultModels:[{id:"coder-model",name:"Coder Model (Qwen 3.6 Plus)",alias:"coder-model",envKey:"OPENAI_MODEL",defaultValue:"coder-model",isTopLevel:!0},{id:"qwen3-coder-plus",name:"Qwen 3 Coder Plus",alias:"qwen3-coder-plus",envKey:"OPENAI_MODEL",defaultValue:"qwen3-coder-plus"},{id:"qwen3-coder-flash",name:"Qwen 3 Coder Flash",alias:"qwen3-coder-flash",envKey:"OPENAI_MODEL",defaultValue:"qwen3-coder-flash"},{id:"vision-model",name:"Vision Model (Multimodal)",alias:"vision-model",envKey:"OPENAI_MODEL",defaultValue:"vision-model"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6",envKey:"OPENAI_MODEL",defaultValue:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking",envKey:"OPENAI_MODEL",defaultValue:"claude-opus-4-6-thinking"},{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high",envKey:"OPENAI_MODEL",defaultValue:"gemini-3.1-pro-high"},{id:"gemini-3-flash",name:"Gemini 3 Flash",alias:"gemini-3-flash",envKey:"OPENAI_MODEL",defaultValue:"gemini-3-flash"}],guideSteps:[{step:1,title:"Install Qwen Code",desc:"npm install -g @qwen-code/qwen-code"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"Select Models",type:"modelSelector"},{step:5,title:"Save Config",desc:"Copy the JSON below to ~/.qwen/settings.json and export SWITCHBOARD_API_KEY in your shell."}],codeBlock:{language:"json",code:({baseUrl:a,models:b})=>JSON.stringify({modelProviders:{openai:{protocol:"openai",models:b.map(b=>({id:b,name:`Switchboard \xb7 ${b}`,baseUrl:a,envKey:"SWITCHBOARD_API_KEY"}))}}},null,2)}},"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/Hmbown/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. Switchboard 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 switchboard as an OpenAI-compatible provider to route all jcode requests through switchboard'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"}]},grok:{id:"grok",name:"Grok CLI",image:"/providers/xai.png",color:"#000000",description:"Open-source Grok terminal coding agent (grok-dev) via Switchboard",docsUrl:"https://github.com/superagent-ai/grok-cli",configType:"custom",defaultCommand:"grok",notes:[{type:"info",when:"installed",text:"Writes ~/.grok/user-settings.json (apiKey, defaultModel) and ~/.grok/switchboard.env (GROK_BASE_URL). Source the env file before launching grok — the CLI only reads base URL from the environment."},{type:"install",when:"not_installed",text:"Install: curl -fsSL https://raw.githubusercontent.com/superagent-ai/grok-cli/main/install.sh | bash \xb7 or bun add -g grok-dev"}],defaultModels:[{id:"xai/grok-4",name:"Grok 4",alias:"grok-4",defaultValue:"xai/grok-4"},{id:"xai/grok-3",name:"Grok 3",alias:"grok-3",defaultValue:"xai/grok-3"},{id:"xai/grok-3-mini",name:"Grok 3 Mini",alias:"grok-3-mini",defaultValue:"xai/grok-3-mini"}]},pi:{id:"pi",name:"Pi",image:"/providers/pi.svg",color:"#38BDF8",description:"Minimal terminal coding agent (pi.dev) with custom OpenAI-compatible provider",docsUrl:"https://pi.dev",configType:"custom",defaultCommand:"pi",notes:[{type:"info",when:"installed",text:"Adds a switchboard provider to ~/.pi/agent/models.json. In Pi use /model (Ctrl+L) and pick switchboard/<model-id>."},{type:"install",when:"not_installed",text:"Install: npm install -g --ignore-scripts @earendil-works/pi-coding-agent \xb7 or curl -fsSL https://pi.dev/install.sh | sh"}]},aider:{id:"aider",name:"Aider",image:"/providers/aider.svg",color:"#34D399",description:"AI pair programming in your terminal (OpenAI-compatible)",docsUrl:"https://aider.chat",configType:"custom",defaultCommand:"aider",notes:[{type:"info",when:"installed",text:"Writes ~/.aider.conf.yml with openai-api-base, openai-api-key, and model (openai/<id>)."},{type:"install",when:"not_installed",text:"Install: pipx install aider-chat \xb7 or python -m pip install aider-chat"}]},"gemini-cli":{id:"gemini-cli",name:"Gemini CLI",image:"/providers/gemini-cli.png",color:"#4285F4",description:"Google Gemini CLI pointed at Switchboard (OpenAI-compatible env)",docsUrl:"https://github.com/google-gemini/gemini-cli",configType:"custom",defaultCommand:"gemini",notes:[{type:"info",when:"installed",text:"Writes ~/.gemini/switchboard.env (OPENAI_* + GEMINI_*). Source it before running gemini so requests hit Switchboard."},{type:"install",when:"not_installed",text:"Install: npm install -g @google/gemini-cli"}]}}}};
67
+ `},{filename:"~/.gemini/settings.json",content:JSON.stringify({model:{name:c},experimental:{dynamicModelConfiguration:!0},modelConfigs:{modelDefinitions:Object.fromEntries(d.map(a=>[a,{displayName:`Switchboard \xb7 ${a.split("/").pop()||a}`,family:"switchboard",tier:"custom",isPreview:!1,isVisible:!0,features:{thinking:!0,multimodalToolUse:!0}}]))}},null,2)}]})}let Q="http://localhost:20128";function R({apiKeys:a,cloudEnabled:b,onStatusChange:c}){let[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(()=>a?.[0]?.key||""),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(Q),[y,z]=(0,e.useState)(null),A=g?.isWin===!0,B=A||g?.hasCachedPassword||g?.needsSudoPassword===!1,C=g?.isAdmin!==!1;!C&&(A||g?.hasCachedPassword||g?.needsSudoPassword);let D=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/cli-tools/antigravity-mitm");if(a.ok){let b=await a.json();h(b),b.mitmRouterBaseUrl&&x(b.mitmRouterBaseUrl),c?.(b)}}catch{h({running:!1,certExists:!1,dnsStatus:{}})}},[c]),E=a=>{v(null),g&&(B?F(a,""):(r(a),l(!0),t(null)))},F=async(c,d,e=!1)=>{j(!0),v(null);try{let f;if("trust-cert"===c)f=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:d})});else if("start"===c){let c=o?.trim()||(a?.length>0?a[0].key:null)||(b?null:"sk_switchboard");f=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,sudoPassword:d,mitmRouterBaseUrl:w.trim()||Q,forceKillPort443:e})})}else f=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:d})});if(!f.ok){let a=await f.json().catch(()=>({}));if("PORT_443_BUSY"===a.code&&a.portOwner){l(!1),z({owner:a.portOwner,password:d});return}v(a.error||`Failed to ${c} MITM server`);return}l(!1),n(""),z(null),await D()}catch(a){v(a.message||"Network error")}finally{j(!1),r(null)}},G=()=>{m.trim()?F(q,m):t("Sudo password is required")},H=g?.running;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,d.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),H?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Running"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:g?.certExists},{label:"Trusted",ok:g?.certTrusted},{label:"Server",ok:H}].map(({label:a,ok:b})=>(0,d.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${b?"text-green-600":"text-text-muted"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:b?"check_circle":"cancel"}),a]},a))})]}),(0,d.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from Switchboard"]}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,d.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → Switchboard → response to Antigravity/Copilot"]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Switchboard Base URL"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",value:w,onChange:a=>x(a.target.value),placeholder:Q,disabled:H,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!H&&(0,d.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsx)("input",{type:"text",list:"mitm-api-keys",value:o,onChange:a=>p(a.target.value),placeholder:b?"Enter or pick API key":"sk_switchboard (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),a?.length>0&&(0,d.jsx)("datalist",{id:"mitm-api-keys",children:a.map(a=>(0,d.jsx)("option",{value:a.key,children:a.name||a.key},a.id))})]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center","data-i18n-skip":"true",children:[g?.certExists&&!g?.certTrusted&&(0,d.jsxs)("button",{onClick:()=>E("trust-cert"),disabled:i,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-2 text-xs font-medium text-yellow-600 transition-colors hover:bg-yellow-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),H?(0,d.jsxs)("button",{onClick:()=>E("stop"),disabled:i,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,d.jsxs)("button",{onClick:()=>E("start"),disabled:i||!g||A&&!C,title:A&&!C?"Administrator required":void 0,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),H&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),u&&(0,d.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,d.jsx)("span",{children:u})]}),A&&!C&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,d.jsx)("span",{children:"Administrator required — restart Switchboard as Administrator to use MITM"})]})]})}),k&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:m,onChange:a=>n(a.target.value),onKeyDown:a=>{"Enter"!==a.key||i||G()}}),s&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:s})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{l(!1),n(""),t(null)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:G,loading:i,children:"Confirm"})]})]})}),y&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Port 443 Already In Use"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 text-xs text-text-muted",children:[(0,d.jsx)("p",{children:"Port 443 is currently used by another process:"}),(0,d.jsxs)("p",{className:"font-mono text-text-main","data-i18n-skip":"true",children:[y.owner.name," (PID ",y.owner.pid,")"]}),(0,d.jsx)("p",{children:"Kill this process to start MITM Server?"})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{z(null),j(!1)},disabled:i,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:()=>{F("start",y?.password||"",!0)},loading:i,children:"Kill & Start"})]})]})})]})}var S=c(36811);function T({tool:a,isExpanded:b,onToggle:c,serverRunning:h,dnsActive:i,hasCachedPassword:j,needsSudoPassword:k,isWin:l,apiKeys:m,activeProviders:n,hasActiveProviders:o,modelAliases:p={},cloudEnabled:q,onDnsChange:r}){let[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)({}),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(null),K=S.TOOL_HOSTS[a.id]??[],L=l||j||!1===k;(0,e.useCallback)(async()=>{try{let b=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${a.id}`);if(b.ok){let a=await b.json();Object.keys(a.aliases||{}).length>0&&F(a.aliases)}}catch{}},[a.id]);let M=(0,e.useCallback)(async b=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,mappings:b})})}catch{}},[a.id]),N=(a,b)=>{F(c=>({...c,[a]:b}))},O=()=>{if(!h)return;let a=i?"disable":"enable";L?P(a,""):(B(a),x(!0),D(null))},P=async(b,c)=>{t(!0),v(null);try{let d=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:a.id,action:b,sudoPassword:c})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to toggle DNS");"enable"===b&&v(`Restart ${a.name} to apply changes`),x(!1),z(""),r?.(e)}catch{}finally{t(!1),B(null)}},Q=()=>{y.trim()?P(A,y):D("Sudo password is required")};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(f.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:c,children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),h?i?(0,d.jsx)(f.Ex,{variant:"success",size:"sm",children:"Active"}):(0,d.jsx)(f.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,d.jsx)(f.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted sm:truncate",children:["Intercept ",a.name," requests via MITM proxy"]})]})]}),(0,d.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${b?"rotate-180":""}`,children:"expand_more"})]}),b&&(0,d.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[K.length>0&&(0,d.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,d.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:K.map(a=>(0,d.jsxs)("li",{children:["127.0.0.1 ",a]},a))})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,d.jsxs)("p",{children:["Toggle DNS to redirect ",a.name," traffic through Switchboard via MITM."]}),!i&&(0,d.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),a.defaultModels?.length>0&&(0,d.jsx)("div",{className:"flex flex-col gap-2",children:a.defaultModels.map(a=>(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[9rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right",children:a.name}),(0,d.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,d.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,d.jsx)("input",{type:"text",value:E[a.alias]||"",onChange:b=>N(a.alias,b.target.value),onBlur:b=>{var c,d;return c=a.alias,d=b.target.value,void M({...E,[c]:d})},placeholder:"provider/model-id",disabled:!i,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 ${!i?"opacity-50 cursor-not-allowed":""}`}),E[a.alias]&&(0,d.jsx)("button",{onClick:()=>{N(a.alias,""),M({...E,[a.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,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,d.jsx)("button",{onClick:()=>{J(a.alias),H(!0)},disabled:!o||!i,className:`rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 ${o&&i?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},a.alias))}),a.defaultModels?.length===0&&(0,d.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:items-start",children:[i?(0,d.jsxs)("button",{onClick:O,disabled:!h||s,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,d.jsxs)("button",{onClick:O,disabled:!h||s,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),u&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,d.jsx)("span",{children:u})]})]})]})]}),w&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,d.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,d.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,d.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,d.jsx)(f.pd,{type:"password",placeholder:"Enter sudo password",value:y,onChange:a=>z(a.target.value),onKeyDown:a=>{"Enter"!==a.key||s||Q()}}),C&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,d.jsx)("span",{children:C})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)(f.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),z(""),D(null)},disabled:s,children:"Cancel"}),(0,d.jsx)(f.$n,{variant:"primary",size:"sm",onClick:Q,loading:s,children:"Confirm"})]})]})}),(0,d.jsx)(f.rq,{isOpen:G,onClose:()=>H(!1),onSelect:a=>{if(!I||a.isPlaceholder)return;let b={...E,[I]:a.value};F(b),M(b)},selectedModel:I?E[I]:null,activeProviders:n,modelAliases:p,title:`Select model for ${I}`})]})}var U=c(2116),V=c.n(U);function W({tool:a}){return(0,d.jsx)(V(),{href:"/dashboard/mitm",className:"block",children:(0,d.jsx)(f.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,d.jsx)(g.default,{src:a.image,alt:a.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:a=>{a.target.style.display="none"}})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"font-medium text-sm",children:a.name}),(0,d.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted truncate",children:a.description})]})]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}}};
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=4126,exports.ids=[4126],exports.modules={4126:(a,b,c)=>{c.r(b),c.d(b,{DELETE:()=>C,GET:()=>y,POST:()=>B});var d=c(49796),e=c(23211),f=c(79646),g=c(28354),h=c(79748),i=c.n(h),j=c(33873),k=c.n(j),l=c(21820),m=c.n(l),n=c(23628),o=c(95510),p=c(24424);let q=(0,g.promisify)(f.exec),r=a=>"string"==typeof a?a:a&&"object"==typeof a?a.primary??"":"",s=()=>k().join(m().homedir(),".openclaw"),t=()=>k().join(s(),"openclaw.json"),u=()=>k().join(s(),"switchboard-backup.json"),v=async()=>{try{let a="win32"===m().platform(),b=a?{...process.env,PATH:`${process.env.APPDATA}\\npm;${process.env.PATH}`}:process.env;return await q(a?"where openclaw":"which openclaw",{windowsHide:!0,env:b}),!0}catch{try{return await i().access(t()),!0}catch{return!1}}},w=async()=>{try{let a=t(),b=(await i().readFile(a,"utf-8")).replace(/,(\s*[}\]])/g,"$1");return JSON.parse(b)}catch(a){return null}},x=async a=>{try{let b=k().join(a,"models.json"),c=await i().readFile(b,"utf-8"),d=JSON.parse(c),e=d?.providers?.switchboard?.models;return e?.[0]?.id||null}catch{return null}};async function y(){try{if(!await v())return e.NextResponse.json({installed:!1,settings:null,message:"Open Claw CLI is not installed"});let a=await w(),b=a?.agents?.list||[],c=await Promise.all(b.map(async a=>{let b=a.agentDir?await x(a.agentDir):null;return{...a,model:r(a.model),currentModel:b}}));return e.NextResponse.json({installed:!0,settings:a,agents:c,hasSwitchboard:!!a&&!!a.models&&!!a.models.providers&&!!a.models.providers.switchboard,settingsPath:t()})}catch(a){return console.log("Error checking openclaw settings:",a),e.NextResponse.json({error:"Failed to check openclaw settings"},{status:500})}}let z=async a=>{let b=k().join(a,"models.json");try{return JSON.parse(await i().readFile(b,"utf-8"))}catch(a){if(a?.code==="ENOENT")return{};throw a}},A=async(a,b,c,d)=>{await i().mkdir(a,{recursive:!0});let e=k().join(a,"models.json"),f=await z(a);f.providers||(f.providers={}),f.providers.switchboard={baseUrl:c,apiKey:d||"your_api_key",api:"openai-completions",models:(0,n.rP)(b).map(a=>({id:a,name:a.split("/").pop()||a}))},await (0,o.Yb)(e,JSON.stringify(f,null,2),{secret:!0})};async function B(a){try{let{baseUrl:b,apiKey:c,model:d,models:f,defaultModel:g,agentModels:h={}}=await a.json(),j=(0,n.rP)(f??d),k=j.includes(g||d)?g||d:j[0];if(!(0,n.uI)(b)||!(0,n.iU)(c)||0===j.length)return e.NextResponse.json({error:"baseUrl and at least one model are required"},{status:400});let l=s(),m=t();await i().mkdir(l,{recursive:!0});let p={};try{let a=await i().readFile(m,"utf-8");p=JSON.parse(a)}catch(a){if("ENOENT"!==a.code)throw a}let q=await (async()=>{try{return JSON.parse(await i().readFile(u(),"utf-8"))}catch(a){if(a?.code==="ENOENT")return{};throw a}})();1!==q.version&&(q.version=1,q.mainProvider=(0,o.EA)(p.models?.providers||{},["switchboard"]),q.defaultPrimary=(0,o.EA)(p.agents?.defaults?.model||{},["primary"]),q.defaultModels=Object.fromEntries(Object.entries(p.agents?.defaults?.models||{}).filter(([a])=>a.startsWith("switchboard/"))),q.agents={},q.agentProviders={}),q.agents||={},q.agentProviders||={},p.agents||(p.agents={}),p.agents.defaults||(p.agents.defaults={}),p.agents.defaults.model||(p.agents.defaults.model={}),p.agents.defaults.models||(p.agents.defaults.models={}),p.models||(p.models={}),p.models.providers||(p.models.providers={});let v=b.endsWith("/v1")?b:`${b}/v1`,w=`switchboard/${k}`;Object.keys(p.agents.defaults.models).filter(a=>a.startsWith("switchboard/")).forEach(a=>{delete p.agents.defaults.models[a]}),p.agents.defaults.model.primary=w;let x=new Set(j),y=Object.fromEntries(Object.entries(h).flatMap(([a,b])=>{let[c]=(0,n.rP)(b);return c?[[a,c]]:[]}));if(Object.values(y).forEach(a=>x.add(a)),x.forEach(a=>{p.agents.defaults.models[`switchboard/${a}`]={}}),Array.isArray(p.agents.list)){for(let a of p.agents.list)if(Object.hasOwn(q.agents,a.id)||(q.agents[a.id]=(0,o.EA)(a,["model"]).model),a.agentDir&&!Object.hasOwn(q.agentProviders,a.agentDir)){let b=await z(a.agentDir);q.agentProviders[a.agentDir]=(0,o.EA)(b.providers||{},["switchboard"]).switchboard}p.agents.list=p.agents.list.map(a=>{if(r(a.model).startsWith("switchboard/")){let{model:b,...c}=a;return c}return a})}return await (0,o.Yb)(u(),JSON.stringify(q,null,2),{secret:!0}),p.models.providers.switchboard={baseUrl:v,apiKey:c||"your_api_key",api:"openai-completions",models:[...x].map(a=>({id:a,name:a.split("/").pop()||a}))},Array.isArray(p.agents.list)&&(p.agents.list=p.agents.list.map(a=>{let b=y[a.id];return b?{...a,model:`switchboard/${b}`}:a}),await Promise.all(p.agents.list.map(async a=>{if(!a.agentDir)return;let b=y[a.id]||k;await A(a.agentDir,[b,...x],v,c)}))),await (0,o.Yb)(m,JSON.stringify(p,null,2),{secret:!0}),e.NextResponse.json({success:!0,message:"Open Claw settings applied successfully!",settingsPath:m})}catch(a){return console.log("Error updating openclaw settings:",a),e.NextResponse.json({error:"Failed to update openclaw settings"},{status:500})}}async function C(){try{let a=t(),b={};try{let c=await i().readFile(a,"utf-8");b=JSON.parse(c)}catch(a){if("ENOENT"===a.code)return e.NextResponse.json({success:!0,message:"No settings file to reset"});throw a}let c={};try{c=JSON.parse(await i().readFile(u(),"utf-8"))}catch(a){if(a?.code!=="ENOENT")throw a}if(b.models&&b.models.providers&&(1===c.version?(0,o.S3)(b.models.providers,c.mainProvider):delete b.models.providers.switchboard,0===Object.keys(b.models.providers).length&&delete b.models.providers),b.agents?.defaults?.models){for(let a of Object.keys(b.agents.defaults.models).filter(a=>a.startsWith("switchboard/")))delete b.agents.defaults.models[a];1===c.version&&Object.assign(b.agents.defaults.models,c.defaultModels||{}),0===Object.keys(b.agents.defaults.models).length&&delete b.agents.defaults.models}b.agents?.defaults?.model?.primary?.startsWith("switchboard/")&&(1===c.version?(0,o.S3)(b.agents.defaults.model,c.defaultPrimary):delete b.agents.defaults.model.primary),Array.isArray(b.agents?.list)&&(b.agents.list=b.agents.list.map(a=>{if(!r(a.model).startsWith("switchboard/"))return a;let b=1===c.version?c.agents?.[a.id]:null;if(b?.exists)return{...a,model:b.value};let{model:d,...e}=a;return e}));let d=new Set([...(b.agents?.list||[]).map(a=>a.agentDir).filter(Boolean),...Object.keys(c.agentProviders||{})]);await Promise.all([...d].map(async a=>{let b=await z(a);b.providers?.switchboard&&(1===c.version?(0,o.S3)(b.providers,{switchboard:c.agentProviders?.[a]}):delete b.providers.switchboard,0===Object.keys(b.providers||{}).length&&delete b.providers,await (0,o.Yb)(k().join(a,"models.json"),JSON.stringify(b,null,2),{secret:!0}))})),await (0,o.Yb)(a,JSON.stringify(b,null,2),{secret:!0});try{await i().unlink(u())}catch(a){if(a?.code!=="ENOENT")throw a}return e.NextResponse.json({success:!0,message:"Switchboard settings removed successfully"})}catch(a){return console.log("Error resetting openclaw settings:",a),e.NextResponse.json({error:"Failed to reset openclaw settings"},{status:500})}}(0,p.D)([y,B,C]),(0,d.A)(y,"003d4c5ebe54ccdcd15946a8d40e7c76f749d15350",null),(0,d.A)(B,"4028ea04137778d91760bc334b683cd4afe10744c2",null),(0,d.A)(C,"00ef76831e2e84f6280cc08082a606cb915249e30e",null)},23628:(a,b,c)=>{c.d(b,{Ej:()=>u,F2:()=>j,JW:()=>x,L6:()=>l,TP:()=>s,XI:()=>w,gW:()=>t,hT:()=>r,iU:()=>h,oR:()=>v,rP:()=>i,uI:()=>g,xb:()=>m});var d=c(63294);let e="# switchboard-managed-aider:",f="# switchboard-managed-hermes:";function g(a){return"string"==typeof a&&a.trim().length>0}function h(a){return null==a||"string"==typeof a}function i(a){let b=Array.isArray(a)?a:"string"==typeof a?[a]:[],c=new Set,d=[];for(let a of b){if("string"!=typeof a)continue;let b=a.trim();!b||c.has(b)||(c.add(b),d.push(b))}return d}function j(a,b){let c="string"==typeof a?a.trim():"";return c&&b.includes(c)?c:b[0]||""}function k(a){let b=a.split("/");return b[b.length-1]||a}function l(a,b=[]){let c=new Map(b.filter(a=>a?.id).map(a=>[a.id,a]));return i(a).map(a=>({reasoning:!1,input:["text","image"],contextWindow:2e5,maxTokens:16384,...c.get(a),id:a,name:c.get(a)?.name||k(a)}))}function m({baseUrl:a,models:b,defaultModel:c}){let d=i(b);return{type:"openai-compatible",base_url:a,auth:"bearer",api_key_env:"JCODE_SWITCHBOARD_API_KEY",env_file:"provider-switchboard.env",default_model:j(c,d),model_catalog:!0,requires_api_key:!0,models:d.map(a=>({id:a}))}}function n(a){return Buffer.from(JSON.stringify(a),"utf8").toString("base64url")}function o(a,b){let c=a.split(/\r?\n/).find(a=>a.startsWith(b));if(!c)return null;try{return JSON.parse(Buffer.from(c.slice(b.length),"base64url").toString("utf8"))}catch{return null}}function p(a,b){return a.split(/\r?\n/).filter(a=>!a.startsWith(b)).join("\n")}function q(a){return a?.toJSON?a.toJSON():a}function r(a,{baseUrl:b,apiKey:c,models:f,defaultModel:g}){let h,k=o(a,e)?s(a):a,l=(0,d.Tp)(k||"");if(l.errors.length)throw Error(`Invalid Aider YAML: ${l.errors[0].message}`);let m=i(f),p=j(g,m),t=Object.fromEntries(["openai-api-base","openai-api-key","model","alias"].map(a=>[a,{exists:l.hasIn([a]),value:q(l.getIn([a]))}]));return l.setIn(["openai-api-base"],b),l.setIn(["openai-api-key"],c),l.setIn(["model"],`openai/${p}`),l.setIn(["alias"],(h=new Map,m.map(a=>{let b=a.replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"")||"model",c=(h.get(b)||0)+1;h.set(b,c);let d=1===c?"":`-${c}`;return`switchboard-${b}${d}:openai/${a}`}))),`${l.toString().trimEnd()}
1
+ "use strict";exports.id=4126,exports.ids=[4126],exports.modules={4126:(a,b,c)=>{c.r(b),c.d(b,{DELETE:()=>C,GET:()=>y,POST:()=>B});var d=c(49796),e=c(23211),f=c(79646),g=c(28354),h=c(79748),i=c.n(h),j=c(33873),k=c.n(j),l=c(21820),m=c.n(l),n=c(23628),o=c(95510),p=c(24424);let q=(0,g.promisify)(f.exec),r=a=>"string"==typeof a?a:a&&"object"==typeof a?a.primary??"":"",s=()=>k().join(m().homedir(),".openclaw"),t=()=>k().join(s(),"openclaw.json"),u=()=>k().join(s(),"switchboard-backup.json"),v=async()=>{try{let a="win32"===m().platform(),b=a?{...process.env,PATH:`${process.env.APPDATA}\\npm;${process.env.PATH}`}:process.env;return await q(a?"where openclaw":"which openclaw",{windowsHide:!0,env:b}),!0}catch{try{return await i().access(t()),!0}catch{return!1}}},w=async()=>{try{let a=t(),b=(await i().readFile(a,"utf-8")).replace(/,(\s*[}\]])/g,"$1");return JSON.parse(b)}catch(a){return null}},x=async a=>{try{let b=k().join(a,"models.json"),c=await i().readFile(b,"utf-8"),d=JSON.parse(c),e=d?.providers?.switchboard?.models;return e?.[0]?.id||null}catch{return null}};async function y(){try{if(!await v())return e.NextResponse.json({installed:!1,settings:null,message:"Open Claw CLI is not installed"});let a=await w(),b=a?.agents?.list||[],c=await Promise.all(b.map(async a=>{let b=a.agentDir?await x(a.agentDir):null;return{...a,model:r(a.model),currentModel:b}}));return e.NextResponse.json({installed:!0,settings:a,agents:c,hasSwitchboard:!!a&&!!a.models&&!!a.models.providers&&!!a.models.providers.switchboard,settingsPath:t()})}catch(a){return console.log("Error checking openclaw settings:",a),e.NextResponse.json({error:"Failed to check openclaw settings"},{status:500})}}let z=async a=>{let b=k().join(a,"models.json");try{return JSON.parse(await i().readFile(b,"utf-8"))}catch(a){if(a?.code==="ENOENT")return{};throw a}},A=async(a,b,c,d)=>{await i().mkdir(a,{recursive:!0});let e=k().join(a,"models.json"),f=await z(a);f.providers||(f.providers={}),f.providers.switchboard={baseUrl:c,apiKey:d||"your_api_key",api:"openai-completions",models:(0,n.rP)(b).map(a=>({id:a,name:a.split("/").pop()||a}))},await (0,o.Yb)(e,JSON.stringify(f,null,2),{secret:!0})};async function B(a){try{let{baseUrl:b,apiKey:c,model:d,models:f,defaultModel:g,agentModels:h={}}=await a.json(),j=(0,n.rP)(f??d),k=j.includes(g||d)?g||d:j[0];if(!(0,n.uI)(b)||!(0,n.iU)(c)||0===j.length)return e.NextResponse.json({error:"baseUrl and at least one model are required"},{status:400});let l=s(),m=t();await i().mkdir(l,{recursive:!0});let p={};try{let a=await i().readFile(m,"utf-8");p=JSON.parse(a)}catch(a){if("ENOENT"!==a.code)throw a}let q=await (async()=>{try{return JSON.parse(await i().readFile(u(),"utf-8"))}catch(a){if(a?.code==="ENOENT")return{};throw a}})();1!==q.version&&(q.version=1,q.mainProvider=(0,o.EA)(p.models?.providers||{},["switchboard"]),q.defaultPrimary=(0,o.EA)(p.agents?.defaults?.model||{},["primary"]),q.defaultModels=Object.fromEntries(Object.entries(p.agents?.defaults?.models||{}).filter(([a])=>a.startsWith("switchboard/"))),q.agents={},q.agentProviders={}),q.agents||={},q.agentProviders||={},p.agents||(p.agents={}),p.agents.defaults||(p.agents.defaults={}),p.agents.defaults.model||(p.agents.defaults.model={}),p.agents.defaults.models||(p.agents.defaults.models={}),p.models||(p.models={}),p.models.providers||(p.models.providers={});let v=b.endsWith("/v1")?b:`${b}/v1`,w=`switchboard/${k}`;Object.keys(p.agents.defaults.models).filter(a=>a.startsWith("switchboard/")).forEach(a=>{delete p.agents.defaults.models[a]}),p.agents.defaults.model.primary=w;let x=new Set(j),y=Object.fromEntries(Object.entries(h).flatMap(([a,b])=>{let[c]=(0,n.rP)(b);return c?[[a,c]]:[]}));if(Object.values(y).forEach(a=>x.add(a)),x.forEach(a=>{p.agents.defaults.models[`switchboard/${a}`]={}}),Array.isArray(p.agents.list)){for(let a of p.agents.list)if(Object.hasOwn(q.agents,a.id)||(q.agents[a.id]=(0,o.EA)(a,["model"]).model),a.agentDir&&!Object.hasOwn(q.agentProviders,a.agentDir)){let b=await z(a.agentDir);q.agentProviders[a.agentDir]=(0,o.EA)(b.providers||{},["switchboard"]).switchboard}p.agents.list=p.agents.list.map(a=>{if(r(a.model).startsWith("switchboard/")){let{model:b,...c}=a;return c}return a})}return await (0,o.Yb)(u(),JSON.stringify(q,null,2),{secret:!0}),p.models.providers.switchboard={baseUrl:v,apiKey:c||"your_api_key",api:"openai-completions",models:[...x].map(a=>({id:a,name:a.split("/").pop()||a}))},Array.isArray(p.agents.list)&&(p.agents.list=p.agents.list.map(a=>{let b=y[a.id];return b?{...a,model:`switchboard/${b}`}:a}),await Promise.all(p.agents.list.map(async a=>{if(!a.agentDir)return;let b=y[a.id]||k;await A(a.agentDir,[b,...x],v,c)}))),await (0,o.Yb)(m,JSON.stringify(p,null,2),{secret:!0}),e.NextResponse.json({success:!0,message:"Open Claw settings applied successfully!",settingsPath:m})}catch(a){return console.log("Error updating openclaw settings:",a),e.NextResponse.json({error:"Failed to update openclaw settings"},{status:500})}}async function C(){try{let a=t(),b={};try{let c=await i().readFile(a,"utf-8");b=JSON.parse(c)}catch(a){if("ENOENT"===a.code)return e.NextResponse.json({success:!0,message:"No settings file to reset"});throw a}let c={};try{c=JSON.parse(await i().readFile(u(),"utf-8"))}catch(a){if(a?.code!=="ENOENT")throw a}if(b.models&&b.models.providers&&(1===c.version?(0,o.S3)(b.models.providers,c.mainProvider):delete b.models.providers.switchboard,0===Object.keys(b.models.providers).length&&delete b.models.providers),b.agents?.defaults?.models){for(let a of Object.keys(b.agents.defaults.models).filter(a=>a.startsWith("switchboard/")))delete b.agents.defaults.models[a];1===c.version&&Object.assign(b.agents.defaults.models,c.defaultModels||{}),0===Object.keys(b.agents.defaults.models).length&&delete b.agents.defaults.models}b.agents?.defaults?.model?.primary?.startsWith("switchboard/")&&(1===c.version?(0,o.S3)(b.agents.defaults.model,c.defaultPrimary):delete b.agents.defaults.model.primary),Array.isArray(b.agents?.list)&&(b.agents.list=b.agents.list.map(a=>{if(!r(a.model).startsWith("switchboard/"))return a;let b=1===c.version?c.agents?.[a.id]:null;if(b?.exists)return{...a,model:b.value};let{model:d,...e}=a;return e}));let d=new Set([...(b.agents?.list||[]).map(a=>a.agentDir).filter(Boolean),...Object.keys(c.agentProviders||{})]);await Promise.all([...d].map(async a=>{let b=await z(a);b.providers?.switchboard&&(1===c.version?(0,o.S3)(b.providers,{switchboard:c.agentProviders?.[a]}):delete b.providers.switchboard,0===Object.keys(b.providers||{}).length&&delete b.providers,await (0,o.Yb)(k().join(a,"models.json"),JSON.stringify(b,null,2),{secret:!0}))})),await (0,o.Yb)(a,JSON.stringify(b,null,2),{secret:!0});try{await i().unlink(u())}catch(a){if(a?.code!=="ENOENT")throw a}return e.NextResponse.json({success:!0,message:"Switchboard settings removed successfully"})}catch(a){return console.log("Error resetting openclaw settings:",a),e.NextResponse.json({error:"Failed to reset openclaw settings"},{status:500})}}(0,p.D)([y,B,C]),(0,d.A)(y,"007d9a4e2992ca08721b8243800a5b6bfdb9088801",null),(0,d.A)(B,"40d6e42a125e02584c7c77632c5bf2886649004449",null),(0,d.A)(C,"00acf2e9df26847b2041e0ebb9c9ffbc0ddff5c366",null)},23628:(a,b,c)=>{c.d(b,{Ej:()=>u,F2:()=>j,JW:()=>x,L6:()=>l,TP:()=>s,XI:()=>w,gW:()=>t,hT:()=>r,iU:()=>h,oR:()=>v,rP:()=>i,uI:()=>g,xb:()=>m});var d=c(63294);let e="# switchboard-managed-aider:",f="# switchboard-managed-hermes:";function g(a){return"string"==typeof a&&a.trim().length>0}function h(a){return null==a||"string"==typeof a}function i(a){let b=Array.isArray(a)?a:"string"==typeof a?[a]:[],c=new Set,d=[];for(let a of b){if("string"!=typeof a)continue;let b=a.trim();!b||c.has(b)||(c.add(b),d.push(b))}return d}function j(a,b){let c="string"==typeof a?a.trim():"";return c&&b.includes(c)?c:b[0]||""}function k(a){let b=a.split("/");return b[b.length-1]||a}function l(a,b=[]){let c=new Map(b.filter(a=>a?.id).map(a=>[a.id,a]));return i(a).map(a=>({reasoning:!1,input:["text","image"],contextWindow:2e5,maxTokens:16384,...c.get(a),id:a,name:c.get(a)?.name||k(a)}))}function m({baseUrl:a,models:b,defaultModel:c}){let d=i(b);return{type:"openai-compatible",base_url:a,auth:"bearer",api_key_env:"JCODE_SWITCHBOARD_API_KEY",env_file:"provider-switchboard.env",default_model:j(c,d),model_catalog:!0,requires_api_key:!0,models:d.map(a=>({id:a}))}}function n(a){return Buffer.from(JSON.stringify(a),"utf8").toString("base64url")}function o(a,b){let c=a.split(/\r?\n/).find(a=>a.startsWith(b));if(!c)return null;try{return JSON.parse(Buffer.from(c.slice(b.length),"base64url").toString("utf8"))}catch{return null}}function p(a,b){return a.split(/\r?\n/).filter(a=>!a.startsWith(b)).join("\n")}function q(a){return a?.toJSON?a.toJSON():a}function r(a,{baseUrl:b,apiKey:c,models:f,defaultModel:g}){let h,k=o(a,e)?s(a):a,l=(0,d.Tp)(k||"");if(l.errors.length)throw Error(`Invalid Aider YAML: ${l.errors[0].message}`);let m=i(f),p=j(g,m),t=Object.fromEntries(["openai-api-base","openai-api-key","model","alias"].map(a=>[a,{exists:l.hasIn([a]),value:q(l.getIn([a]))}]));return l.setIn(["openai-api-base"],b),l.setIn(["openai-api-key"],c),l.setIn(["model"],`openai/${p}`),l.setIn(["alias"],(h=new Map,m.map(a=>{let b=a.replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"")||"model",c=(h.get(b)||0)+1;h.set(b,c);let d=1===c?"":`-${c}`;return`switchboard-${b}${d}:openai/${a}`}))),`${l.toString().trimEnd()}
2
2
  ${e}${n(t)}
3
3
  `}function s(a){let b=o(a,e);if(!b)return a;let c=(0,d.Tp)(p(a,e));if(c.errors.length)throw Error(`Invalid Aider YAML: ${c.errors[0].message}`);for(let a of["openai-api-base","openai-api-key","model","alias"])b[a]?.exists?c.setIn([a],b[a].value):c.deleteIn([a]);return c.toString()}function t(a,{baseUrl:b,models:c,defaultModel:e}){let g=o(a,f)?u(a):a,h=(0,d.Tp)(g||"");if(h.errors.length)throw Error(`Invalid Hermes YAML: ${h.errors[0].message}`);let k=i(c),l=j(e,k),m=q(h.getIn(["custom_providers"])),p=Array.isArray(m)?m:[],r=p.find(a=>a?.name==="switchboard"),s=q(h.getIn(["model"])),v=p.filter(a=>a?.name!=="switchboard"),w=Object.fromEntries(k.map(a=>[a,{}]));return v.push({name:"switchboard",base_url:b,key_env:"SWITCHBOARD_API_KEY",api_mode:"chat_completions",models:w}),h.setIn(["custom_providers"],v),h.setIn(["model"],{...s&&"object"==typeof s?s:{},default:l,provider:"custom:switchboard"}),`${h.toString().trimEnd()}
4
4
  ${f}${n({previousProvider:r??null,previousModel:s??null})}