switchboard-router 0.6.11 → 0.6.13

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 (383) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +3 -3
  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 +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +3 -3
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  84. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  85. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  86. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  87. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  88. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  89. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  93. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  94. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  95. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  96. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
  97. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  98. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  99. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  100. package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  110. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +4 -4
  112. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  114. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  117. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  123. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  125. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  127. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  131. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +3 -3
  133. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
  135. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  137. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  141. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
  147. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
  171. package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  175. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  196. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js +1 -1
  204. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js +1 -1
  206. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js +1 -1
  208. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  251. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  255. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  257. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  268. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  271. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  276. package/app/.next-cli-build/server/app/callback.html +1 -1
  277. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  278. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  279. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  280. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
  281. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  282. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  283. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  284. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  286. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  287. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  288. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  289. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  290. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
  291. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  292. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  293. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  294. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  295. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  296. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/index.html +1 -1
  298. package/app/.next-cli-build/server/app/index.rsc +3 -3
  299. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  300. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  301. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  302. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
  303. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  304. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  305. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  306. package/app/.next-cli-build/server/app/landing.html +1 -1
  307. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  308. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  309. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  310. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
  311. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  312. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  313. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  314. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  315. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  316. package/app/.next-cli-build/server/app/login.html +1 -1
  317. package/app/.next-cli-build/server/app/login.rsc +3 -3
  318. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  319. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  320. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
  321. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  322. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  323. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  324. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  327. package/app/.next-cli-build/server/app-paths-manifest.json +3 -3
  328. package/app/.next-cli-build/server/chunks/194.js +1 -1
  329. package/app/.next-cli-build/server/chunks/{1062.js → 3787.js} +2 -2
  330. package/app/.next-cli-build/server/chunks/4126.js +1 -1
  331. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  332. package/app/.next-cli-build/server/chunks/5821.js +1 -1
  333. package/app/.next-cli-build/server/chunks/7155.js +1 -1
  334. package/app/.next-cli-build/server/chunks/869.js +1 -1
  335. package/app/.next-cli-build/server/chunks/8998.js +1 -1
  336. package/app/.next-cli-build/server/chunks/9489.js +2 -2
  337. package/app/.next-cli-build/server/chunks/9696.js +5 -5
  338. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  339. package/app/.next-cli-build/server/pages/404.html +1 -1
  340. package/app/.next-cli-build/server/pages/500.html +1 -1
  341. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  342. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  343. package/app/.next-cli-build/static/chunks/{1321-3452b6d48b71f4a2.js → 1321-f614c7c6e5ab4bcc.js} +1 -1
  344. package/app/.next-cli-build/static/chunks/{5497-d866b97bf9a716ba.js → 5497-3d546c1b7aa357b1.js} +5 -5
  345. package/app/.next-cli-build/static/chunks/594-e392353337efef19.js +64 -0
  346. package/app/.next-cli-build/static/chunks/6430-4c528cfc35666c11.js +1 -0
  347. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/{page-d720efb4c9d427e6.js → page-62bea7b75b3f2692.js} +1 -1
  348. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-04509a38b9fd3dcf.js → page-1eb380280857cf20.js} +1 -1
  349. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-fa35870caaeabe20.js → page-9aa986f145130c08.js} +1 -1
  350. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-aa9c65a5e73a3f5d.js → page-a09d7692b3ea9179.js} +1 -1
  351. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/{page-a8d77d24b4c71915.js → page-4bf0abe7c7119ac0.js} +1 -1
  352. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/routing/{page-95f09ae849f539d6.js → page-1fc70bcd434deb73.js} +1 -1
  353. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-6678759c536b4008.js → page-fdc5377da12ec933.js} +1 -1
  354. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-b48bd39cb03c4985.js +3 -0
  355. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-183cf5498e6d3e42.js → page-9e60537a4b8f5a0c.js} +1 -1
  356. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-b67e7e3b9acaf1cc.js → page-95bf830096d019fd.js} +1 -1
  357. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-a4bad553cba810e7.js → page-45ebe6bb46c9f65e.js} +1 -1
  358. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/{page-0568602ac2385103.js → page-7ac82c8930583633.js} +1 -1
  359. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-f6e3507247a819e5.js → page-961013b570bbeac6.js} +1 -1
  360. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-08fe6612a31239da.js → page-8619928e4b74f46b.js} +1 -1
  361. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-a1ab95a02951c91d.js → page-b5b9038ea28e63b6.js} +1 -1
  362. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-e023b0417bbc3b44.js +10 -0
  363. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-608cdc11e7047159.js → page-fe7ccc9c117d7d38.js} +1 -1
  364. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{page-ad84a479883e6cc3.js → page-d3e35265648406f2.js} +1 -1
  365. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-f312c1076859630e.js → page-5ac3900baf3fe9ca.js} +1 -1
  366. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/[id]/{page-90277b8688f387c1.js → page-bb4af1ac9b13a514.js} +1 -1
  367. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-33e127c15efc66a5.js → page-4382c14f28ddfc7f.js} +1 -1
  368. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-0f74a450b98fa125.js → page-1b2b6b736fe98698.js} +1 -1
  369. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-ad2eda4b48c9319b.js → page-92fe95bd4e6b3d0a.js} +1 -1
  370. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-025d20cc7b091120.js → page-4c47b9660f3066e2.js} +1 -1
  371. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-d1fa5b81e1c386ab.js +1 -0
  372. package/app/package.json +1 -1
  373. package/cli.js +18 -2
  374. package/package.json +1 -1
  375. package/src/cli/interfaceMenu.js +11 -4
  376. package/app/.next-cli-build/static/chunks/1631-cb80453bf5d4173d.js +0 -1
  377. package/app/.next-cli-build/static/chunks/2176-8ad9ce4b3cb01006.js +0 -1
  378. package/app/.next-cli-build/static/chunks/2280-61262f8359f37a85.js +0 -64
  379. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-59e92d48daea1aed.js +0 -3
  380. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-c6f3cad64d4ef25a.js +0 -10
  381. package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-acc24d6e7d8eb782.js +0 -1
  382. /package/app/.next-cli-build/static/{cirxzk63Mj76HYSOHUdGc → y86nLCzoD011gXPeccvk9}/_buildManifest.js +0 -0
  383. /package/app/.next-cli-build/static/{cirxzk63Mj76HYSOHUdGc → y86nLCzoD011gXPeccvk9}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[624],{61872:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var a=s(95155),r=s(12115),l=s(73321),o=s(98500),n=s.n(o),i=s(21742),c=s(16746),d=s(28408),x=s(32539),m=s(59656),p=s(84420),u=s(19381),h=s(94977),b=s(48035),j=s(67869),g=s(67389),f=s(85545),N=s(35497);let y=["#3987e5","#199e70","#c98500","#9085e9","#008300","#e66767"],v="#8a8172",k=[{key:"router",label:"Router"},{key:"bandit_policy",label:"Bandit policy"},{key:"cached_route",label:"Cached route"},{key:"exploration",label:"Exploration"},{key:"judge_flag_escalation",label:"Judge escalation"},{key:"fallback_rescue",label:"Fallback rescue"}],w={backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",color:"var(--color-text)",fontSize:"12px"};function S({active:e,payload:t}){if(!e||!t?.length)return null;let s=t[0].payload;return(0,a.jsxs)("div",{className:"font-mono",style:w,children:[(0,a.jsx)("p",{className:"mb-1 text-text-muted",children:s.worker}),(0,a.jsxs)("p",{className:"text-text-main",children:["Score: ",Math.round(Number(s.avgScore)||0)]}),null!=s.winRate&&(0,a.jsxs)("p",{className:"text-text-main",children:["Win rate: ",Math.round(100*s.winRate),"%"]}),(0,a.jsxs)("p",{className:"text-text-main",children:["Latency: ",Math.round(Number(s.avgLatencyMs)||0),"ms"]})]})}function C(){return(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("p",{className:"text-sm text-text-muted p-4",children:"Loading insights…"}),children:(0,a.jsx)(M,{})})}function M(){let e,t,s=(0,l.useSearchParams)().get("combo")||"",[o,C]=(0,r.useState)(null),[M,L]=(0,r.useState)(null),[$,R]=(0,r.useState)(!1),[_,F]=(0,r.useState)(""),[A,E]=(0,r.useState)(""),[T,P]=(0,r.useState)(14),[z,W]=(0,r.useState)(""),[Z,J]=(0,r.useState)(""),[I,K]=(0,r.useState)(!1),q=(0,r.useCallback)(async()=>{if(s){R(!0),F("");try{let e=new URLSearchParams({combo:s,days:String(T)});z&&e.set("cluster",z),Z&&e.set("worker",Z),I&&e.set("exploration","1");let[t,a]=await Promise.all([fetch(`/api/routing/insights?${e}`,{cache:"no-store"}),fetch(`/api/routing/stats?combo=${encodeURIComponent(s)}&days=${T}`,{cache:"no-store"}).then(async e=>e.ok?e.json():null).catch(()=>null)]),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to load insights");C(r),L(a)}catch(e){F(e.message||"Failed"),C(null),L(null)}finally{R(!1)}}},[s,T,z,Z,I]);(0,r.useEffect)(()=>{q()},[q]);let D=(0,r.useCallback)(async(e,t)=>{if(e)try{let s=await fetch("/api/routing/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:e,rating:t})}),a=await s.json().catch(()=>({}));if(!s.ok)throw Error(a.error||"Feedback failed");E(0===t?"Feedback cleared":"Thanks — feedback recorded"),await q()}catch(e){E(e.message||"Feedback failed")}},[q]),B=(0,r.useMemo)(()=>{if(!o?.heatmap)return 100;let e=1;for(let t of o.heatmap)for(let s of t.cells||[])null!=s.avg&&s.avg>e&&(e=s.avg);return e},[o]),U=M?.timeline||[],G=(e=[...new Set([...(o?.modelStats||[]).map(e=>e.worker),...U.map(e=>e.worker)].filter(Boolean))].sort(),t={},e.forEach((e,s)=>{t[e]=s<6?y[s]:v}),t),V=(o?.modelStats||[]).map(e=>({...e,workerLabel:e.worker.split("/").pop(),winRate:null!=e.wins&&Number(e.n)>0?Number(e.wins)/Number(e.n):null})),H=[...new Set(U.map(e=>e.worker).filter(Boolean))].sort(),Q=H.filter(e=>G[e]!==v),X=H.some(e=>G[e]===v),Y=new Map;for(let e of U){let t=Number(e.avgScore);if(!Number.isFinite(t))continue;let s=Y.get(e.day)||{day:e.day,otherN:0,otherScore:0};if(G[e.worker]===v){let a=Number(e.n)||0;s.otherN+=a,s.otherScore+=t*a}else s[e.worker]=t;Y.set(e.day,s)}let ee=[...Y.values()].map(e=>(e.otherN>0&&(e.Other=e.otherScore/e.otherN),delete e.otherN,delete e.otherScore,e)),et=X?[...Q,"Other"]:Q,es=M?.pickSource||{},ea=Object.values(es).reduce((e,t)=>e+(Number(t)||0),0),er=ea?Math.round(((Number(es.bandit_policy)||0)+(Number(es.cached_route)||0))/ea*100):null,el=U.reduce((e,t)=>e+(Number(t.n)||0),0),eo=U.reduce((e,t)=>e+(Number(t.avgScore)||0)*(Number(t.n)||0),0),en=M?.judgeCoverage,ei=en?.total?Math.round(Number(en.judged)/Number(en.total)*100):null;return s?(0,a.jsxs)("div",{className:"flex flex-col gap-5 max-w-[1180px]",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("h1",{className:"text-[17px] font-semibold tracking-tight",children:"Routing insights"}),(0,a.jsxs)("p",{className:"text-xs font-mono text-text-subtle",children:["combo: ",s,o?.strategy?.routerModel?` \xb7 router ${o.strategy.routerModel}`:"",o?.strategy?.objective?` \xb7 ${o.strategy.objective}`:"",o?.strategy?.explorationRate!=null?` \xb7 ε=${Math.round((o.strategy.explorationRate??.05)*100)}% (cap ${Math.round((o.strategy.explorationRateCap??.2)*100)}%)`:""]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[(0,a.jsxs)("select",{value:T,onChange:e=>P(Number(e.target.value)||14),className:"text-[11.5px] font-mono text-text-subtle px-2 py-1.5 rounded-[7px] bg-surface-2 border border-border",title:"Date range",children:[(0,a.jsx)("option",{value:7,children:"last 7 days"}),(0,a.jsx)("option",{value:14,children:"last 14 days"}),(0,a.jsx)("option",{value:30,children:"last 30 days"}),(0,a.jsx)("option",{value:90,children:"last 90 days"})]}),(0,a.jsxs)("select",{value:z,onChange:e=>W(e.target.value),className:"text-[11.5px] font-mono text-text-subtle px-2 py-1.5 rounded-[7px] bg-surface-2 border border-border max-w-[140px]",title:"Filter cluster",children:[(0,a.jsx)("option",{value:"",children:"all clusters"}),(o?.clusters||[]).map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsxs)("select",{value:Z,onChange:e=>J(e.target.value),className:"text-[11.5px] font-mono text-text-subtle px-2 py-1.5 rounded-[7px] bg-surface-2 border border-border max-w-[160px]",title:"Filter worker",children:[(0,a.jsx)("option",{value:"",children:"all workers"}),(o?.workers||[]).map(e=>(0,a.jsx)("option",{value:e,children:e.split("/").pop()},e))]}),(0,a.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:I,onChange:e=>K(e.target.checked)}),"exploration only"]}),(0,a.jsx)(N.$n,{size:"sm",variant:"secondary",onClick:q,disabled:$,children:"Refresh"}),(0,a.jsx)(N.$n,{size:"sm",disabled:$,onClick:async()=>{E("");try{let e=await fetch("/api/routing/learn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboName:s})}),t=await e.json();E(t.message||JSON.stringify(t)),await q()}catch(e){E(e.message)}},children:"Relearn now"}),(0,a.jsx)(n(),{href:"/dashboard/combos",className:"text-xs text-text-muted hover:text-primary px-2 py-1.5",children:"← Combos"})]})]}),A&&(0,a.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:A}),_&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:_}),$&&!o&&(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Loading…"}),o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,a.jsx)(O,{label:"Requests",value:String(o.eventCount??0)}),(0,a.jsx)(O,{label:"Need for learn",value:o.needMore>0?`${o.needMore} more`:"ready"}),(0,a.jsx)(O,{label:"Active version",value:o.promoted?`v${o.promoted.version}`:"—"}),(0,a.jsx)(O,{label:"Eval score",value:o.promoted?.evalScore!=null?Number(o.promoted.evalScore).toFixed(1):"—"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,a.jsx)(O,{label:"Router-skip %",value:null==er?"—":`${er}%`}),(0,a.jsx)(O,{label:"Avg score",value:el>0?(eo/el).toFixed(1):"—"}),(0,a.jsx)(O,{label:"Judge coverage %",value:null==ei?"—":`${ei}%`}),(0,a.jsx)(O,{label:"Total picks",value:String(ea)})]}),(0,a.jsxs)("p",{className:"text-[11px] text-text-subtle font-mono -mt-2",children:["Request-level counts (one per chat). Intermediate fallback attempts",null!=o.attemptCount&&o.attemptCount!==o.eventCount?` (${o.attemptCount} attempt rows)`:""," ","feed the bandit but not the min-events gate. Single-worker and heuristic shortcuts are not logged here."]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1 flex-wrap gap-2",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Win-rate heatmap"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[10.5px] font-mono text-text-subtle",children:[(0,a.jsx)("span",{children:"low"}),(0,a.jsx)("span",{className:"w-[120px] h-2 rounded",style:{background:"linear-gradient(90deg,rgba(229,180,84,.1),rgba(229,180,84,.72))"}}),(0,a.jsx)("span",{children:"high \xb7 number always shown"})]})]}),(0,a.jsx)("p",{className:"text-[11.5px] font-mono text-text-subtle mb-3",children:"cluster \xd7 worker \xb7 average outcome score (0–100)"}),o.clusters?.length&&o.workers?.length?(0,a.jsxs)("div",{className:"grid gap-1 overflow-x-auto",style:{gridTemplateColumns:`112px repeat(${o.workers.length}, minmax(56px, 1fr))`},children:[(0,a.jsx)("div",{}),o.workers.map(e=>(0,a.jsx)("div",{className:"font-mono text-[10.5px] text-text-muted text-center pb-1 truncate",title:e,children:e.split("/").pop()},e)),o.heatmap.map(e=>(0,a.jsxs)("div",{className:"contents",children:[(0,a.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-text-muted flex items-center font-medium",children:e.cluster}),e.cells.map(t=>{let s=t.avg,r=null==s||B<=0?0:Math.min(1,s/B);return(0,a.jsx)("div",{className:"rounded text-center font-mono text-[11px] py-2 border border-border",style:{background:`rgba(229,180,84,${.08+.55*r})`,color:null==s?"#6F6653":"#ECE4D2"},title:`${t.worker}: n=${t.n}`,children:null==s?"—":Math.round(s)},`${e.cluster}-${t.worker}`)})]},e.cluster))]}):(0,a.jsx)("p",{className:"text-sm text-text-muted py-6 text-center",children:"No routing events yet. Point a client at this combo with strategy Auto."})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Score trend"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-2",children:"mean outcome score per worker per day (request-level)"}),0===ee.length?(0,a.jsx)("p",{className:"text-xs text-text-muted py-6 text-center",children:"No routing data in this window — Auto combos learn as they route"}):(0,a.jsx)(i.u,{width:"100%",height:220,children:(0,a.jsxs)(c.b,{data:ee,margin:{top:8,right:12,left:0,bottom:0},children:[(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,a.jsx)(x.W,{dataKey:"day",tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickFormatter:e=>String(e).slice(5),tickLine:!1,axisLine:!1}),(0,a.jsx)(m.h,{domain:[0,100],tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1,width:32}),(0,a.jsx)(p.m,{contentStyle:w,itemStyle:{color:"var(--color-text)"},labelStyle:{color:"var(--color-text-muted)"},formatter:(e,t)=>[Math.round(Number(e)),t]}),et.length>=2&&(0,a.jsx)(u.s,{formatter:e=>(0,a.jsx)("span",{className:"font-mono text-[10px] text-text-muted",children:e})}),et.map(e=>(0,a.jsx)(h.N1,{type:"monotone",dataKey:t=>t[e]??null,name:"Other"===e?"Other":e.split("/").pop(),stroke:"Other"===e?v:G[e],strokeWidth:2,dot:!1,activeDot:{r:4},connectNulls:!0,isAnimationActive:!1},e))]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Worker comparison"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-3",children:"average outcome score (0–100)"}),0===V.length?(0,a.jsx)("p",{className:"text-xs text-text-muted py-6 text-center",children:"No routing data in this window — Auto combos learn as they route"}):(0,a.jsx)(i.u,{width:"100%",height:Math.max(180,34*V.length),children:(0,a.jsxs)(b.E,{data:V,layout:"vertical",margin:{top:2,right:34,left:0,bottom:0},children:[(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.1,horizontal:!1}),(0,a.jsx)(x.W,{type:"number",domain:[0,100],tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(m.h,{type:"category",dataKey:"workerLabel",width:110,tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(p.m,{content:(0,a.jsx)(S,{}),contentStyle:w}),(0,a.jsxs)(j.yP,{dataKey:"avgScore",name:"Average score",barSize:16,radius:[0,4,4,0],isAnimationActive:!1,children:[V.map(e=>(0,a.jsx)(g.f,{fill:G[e.worker]||v},e.worker)),(0,a.jsx)(f.Ze,{dataKey:"avgScore",position:"right",formatter:e=>Math.round(Number(e)||0),fill:"var(--color-text-muted)",className:"font-mono"})]})]})})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Pick source"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-3",children:"terminal selections in the selected window"}),0===ea?(0,a.jsx)("p",{className:"text-xs text-text-muted py-6 text-center",children:"No routing data in this window — Auto combos learn as they route"}):(0,a.jsx)(i.u,{width:"100%",height:180,children:(0,a.jsxs)(b.E,{data:[{name:"window",...es}],margin:{top:8,right:8,left:0,bottom:0},children:[(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.1,vertical:!1}),(0,a.jsx)(x.W,{type:"number",tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(m.h,{type:"category",dataKey:"name",width:48,tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(p.m,{contentStyle:w,itemStyle:{color:"var(--color-text)"},labelStyle:{color:"var(--color-text-muted)"}}),(0,a.jsx)(u.s,{formatter:e=>(0,a.jsx)("span",{className:"font-mono text-[10px] text-text-muted",children:e})}),k.map((e,t)=>(0,a.jsx)(j.yP,{dataKey:e.key,name:e.label,stackId:"s",fill:t<6?y[t]:v,isAnimationActive:!1},e.key))]})})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Model performance"}),(0,a.jsxs)("div",{className:"mt-3 space-y-2",children:[0===(o.modelStats||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No data"}),(o.modelStats||[]).map(e=>(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_52px_60px_40px] gap-2 items-center text-xs",children:[(0,a.jsx)("span",{className:"font-mono truncate text-text-main",title:e.worker,children:e.worker}),(0,a.jsx)("span",{className:"text-right font-mono text-text-muted",children:null!=e.avgScore?Math.round(e.avgScore):"—"}),(0,a.jsx)("span",{className:"text-right font-mono text-text-muted",children:null!=e.avgLatencyMs?`${Math.round(e.avgLatencyMs)}ms`:"—"}),(0,a.jsx)("span",{className:"text-right font-mono text-text-subtle",children:e.errors||0})]},e.worker))]})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Learning versions"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-2",children:"immutable \xb7 rollback-safe"}),(0,a.jsxs)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[0===(o.versions||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No versions yet"}),(o.versions||[]).map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs border-b border-border py-1.5",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"font-mono text-text-main",children:["v",e.version,e.promoted?" \xb7 active":""]}),(0,a.jsxs)("div",{className:"text-[10px] text-text-subtle font-mono",children:["eval ",null!=e.evalScore?Number(e.evalScore).toFixed(1):"—"," \xb7"," ",e.source]})]}),!e.promoted&&(0,a.jsx)("button",{type:"button",className:"text-primary text-[11px] hover:underline",onClick:async()=>{await fetch("/api/routing/versions/promote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})}),q()},children:"Promote"})]},e.id))]}),o.promoted?.prevVersionId&&(0,a.jsx)(N.$n,{size:"sm",variant:"outline",className:"mt-3",onClick:async()=>{await fetch("/api/routing/versions/rollback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboName:s})}),q()},children:"Rollback"})]})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Recent decisions"}),(0,a.jsxs)("div",{className:"mt-3 overflow-x-auto",children:[(0,a.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,a.jsx)("thead",{className:"text-text-subtle font-mono uppercase tracking-wide",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"py-1 pr-2",children:"Time"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Cluster"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Worker"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Score"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Reason"}),(0,a.jsx)("th",{className:"py-1",children:"Rate"})]})}),(0,a.jsx)("tbody",{children:(o.recent||[]).map(e=>{let t=e.meta?.userRating??null;return(0,a.jsxs)("tr",{className:"border-t border-border",children:[(0,a.jsxs)("td",{className:"py-1.5 pr-2 font-mono text-text-muted whitespace-nowrap",children:[e.timestamp?.slice(0,19)?.replace("T"," "),e.meta?.exploration?(0,a.jsx)("span",{className:"ml-1 text-[9px] text-primary",children:"ε"}):null,e.meta?.judgeScore!=null?(0,a.jsxs)("span",{className:"ml-1 text-[9px] text-text-subtle",title:`LLM-judge score ${e.meta.judgeScore}/10`,children:["J",e.meta.judgeScore]}):null]}),(0,a.jsx)("td",{className:"py-1.5 pr-2",children:e.cluster||"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-2 font-mono truncate max-w-[160px]",title:e.pickedWorker,children:e.pickedWorker?.split("/").pop()||"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-2 font-mono",children:null!=e.outcomeScore?Math.round(e.outcomeScore):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-2 text-text-muted truncate max-w-[240px]",title:e.routerReason,children:e.routerReason||"—"}),(0,a.jsx)("td",{className:"py-1.5 whitespace-nowrap",children:e.requestId?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,a.jsx)("button",{type:"button",title:"Good route",className:`text-[13px] leading-none ${1===t?"text-primary":"text-text-subtle hover:text-primary"}`,onClick:()=>D(e.requestId,+(1!==t)),children:"▲"}),(0,a.jsx)("button",{type:"button",title:"Bad route",className:`text-[13px] leading-none ${-1===t?"text-red-400":"text-text-subtle hover:text-red-400"}`,onClick:()=>D(e.requestId,-1===t?0:-1),children:"▼"})]}):(0,a.jsx)("span",{className:"text-[10px] text-text-subtle",children:"—"})})]},e.id)})})]}),!(o.recent||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted py-4 text-center",children:"No decisions logged"})]})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Exploration log"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-2",children:"epsilon-greedy random picks (meta.exploration)"}),(0,a.jsxs)("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:[0===(o.explorationLog||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No exploration events in this window"}),(o.explorationLog||[]).map(e=>(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px] font-mono border-b border-border py-1",children:[(0,a.jsx)("span",{className:"text-text-muted",children:e.timestamp?.slice(0,19)?.replace("T"," ")}),(0,a.jsx)("span",{children:e.cluster||"—"}),(0,a.jsx)("span",{className:"text-primary",children:e.pickedWorker?.split("/").pop()}),(0,a.jsxs)("span",{className:"text-text-subtle",children:["score ",null!=e.outcomeScore?Math.round(e.outcomeScore):"—"]})]},`ex-${e.id}`))]})]})]})]}):(0,a.jsxs)("div",{className:"max-w-lg space-y-3",children:[(0,a.jsx)("h1",{className:"text-[17px] font-semibold",children:"Routing insights"}),(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Open from a combo card with strategy ",(0,a.jsx)("strong",{children:"Auto"}),", or append"," ",(0,a.jsx)("code",{className:"text-xs",children:"?combo=your-combo"}),"."]}),(0,a.jsx)(n(),{href:"/dashboard/combos",className:"text-sm text-primary hover:underline",children:"← Combos"})]})}function O({label:e,value:t}){return(0,a.jsxs)("div",{className:"rounded-[11px] border border-border bg-surface p-3.5",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle mb-1.5",children:e}),(0,a.jsx)("div",{className:"font-mono text-[18px] font-semibold text-text-main",children:t})]})}},63759:(e,t,s)=>{Promise.resolve().then(s.bind(s,61872))}},e=>{e.O(0,[2574,3862,782,8500,2280,136,1321,7592,5497,8441,3794,7358],()=>e(e.s=63759)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[624],{61872:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var a=s(95155),r=s(12115),l=s(73321),o=s(98500),n=s.n(o),i=s(21742),c=s(16746),d=s(28408),x=s(32539),m=s(59656),p=s(84420),u=s(19381),h=s(94977),b=s(48035),j=s(67869),g=s(67389),f=s(85545),N=s(35497);let y=["#3987e5","#199e70","#c98500","#9085e9","#008300","#e66767"],v="#8a8172",k=[{key:"router",label:"Router"},{key:"bandit_policy",label:"Bandit policy"},{key:"cached_route",label:"Cached route"},{key:"exploration",label:"Exploration"},{key:"judge_flag_escalation",label:"Judge escalation"},{key:"fallback_rescue",label:"Fallback rescue"}],w={backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",color:"var(--color-text)",fontSize:"12px"};function S({active:e,payload:t}){if(!e||!t?.length)return null;let s=t[0].payload;return(0,a.jsxs)("div",{className:"font-mono",style:w,children:[(0,a.jsx)("p",{className:"mb-1 text-text-muted",children:s.worker}),(0,a.jsxs)("p",{className:"text-text-main",children:["Score: ",Math.round(Number(s.avgScore)||0)]}),null!=s.winRate&&(0,a.jsxs)("p",{className:"text-text-main",children:["Win rate: ",Math.round(100*s.winRate),"%"]}),(0,a.jsxs)("p",{className:"text-text-main",children:["Latency: ",Math.round(Number(s.avgLatencyMs)||0),"ms"]})]})}function C(){return(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)("p",{className:"text-sm text-text-muted p-4",children:"Loading insights…"}),children:(0,a.jsx)(M,{})})}function M(){let e,t,s=(0,l.useSearchParams)().get("combo")||"",[o,C]=(0,r.useState)(null),[M,L]=(0,r.useState)(null),[$,R]=(0,r.useState)(!1),[_,F]=(0,r.useState)(""),[A,E]=(0,r.useState)(""),[T,P]=(0,r.useState)(14),[z,W]=(0,r.useState)(""),[Z,J]=(0,r.useState)(""),[I,K]=(0,r.useState)(!1),q=(0,r.useCallback)(async()=>{if(s){R(!0),F("");try{let e=new URLSearchParams({combo:s,days:String(T)});z&&e.set("cluster",z),Z&&e.set("worker",Z),I&&e.set("exploration","1");let[t,a]=await Promise.all([fetch(`/api/routing/insights?${e}`,{cache:"no-store"}),fetch(`/api/routing/stats?combo=${encodeURIComponent(s)}&days=${T}`,{cache:"no-store"}).then(async e=>e.ok?e.json():null).catch(()=>null)]),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to load insights");C(r),L(a)}catch(e){F(e.message||"Failed"),C(null),L(null)}finally{R(!1)}}},[s,T,z,Z,I]);(0,r.useEffect)(()=>{q()},[q]);let D=(0,r.useCallback)(async(e,t)=>{if(e)try{let s=await fetch("/api/routing/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:e,rating:t})}),a=await s.json().catch(()=>({}));if(!s.ok)throw Error(a.error||"Feedback failed");E(0===t?"Feedback cleared":"Thanks — feedback recorded"),await q()}catch(e){E(e.message||"Feedback failed")}},[q]),B=(0,r.useMemo)(()=>{if(!o?.heatmap)return 100;let e=1;for(let t of o.heatmap)for(let s of t.cells||[])null!=s.avg&&s.avg>e&&(e=s.avg);return e},[o]),U=M?.timeline||[],G=(e=[...new Set([...(o?.modelStats||[]).map(e=>e.worker),...U.map(e=>e.worker)].filter(Boolean))].sort(),t={},e.forEach((e,s)=>{t[e]=s<6?y[s]:v}),t),V=(o?.modelStats||[]).map(e=>({...e,workerLabel:e.worker.split("/").pop(),winRate:null!=e.wins&&Number(e.n)>0?Number(e.wins)/Number(e.n):null})),H=[...new Set(U.map(e=>e.worker).filter(Boolean))].sort(),Q=H.filter(e=>G[e]!==v),X=H.some(e=>G[e]===v),Y=new Map;for(let e of U){let t=Number(e.avgScore);if(!Number.isFinite(t))continue;let s=Y.get(e.day)||{day:e.day,otherN:0,otherScore:0};if(G[e.worker]===v){let a=Number(e.n)||0;s.otherN+=a,s.otherScore+=t*a}else s[e.worker]=t;Y.set(e.day,s)}let ee=[...Y.values()].map(e=>(e.otherN>0&&(e.Other=e.otherScore/e.otherN),delete e.otherN,delete e.otherScore,e)),et=X?[...Q,"Other"]:Q,es=M?.pickSource||{},ea=Object.values(es).reduce((e,t)=>e+(Number(t)||0),0),er=ea?Math.round(((Number(es.bandit_policy)||0)+(Number(es.cached_route)||0))/ea*100):null,el=U.reduce((e,t)=>e+(Number(t.n)||0),0),eo=U.reduce((e,t)=>e+(Number(t.avgScore)||0)*(Number(t.n)||0),0),en=M?.judgeCoverage,ei=en?.total?Math.round(Number(en.judged)/Number(en.total)*100):null;return s?(0,a.jsxs)("div",{className:"flex flex-col gap-5 max-w-[1180px]",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("h1",{className:"text-[17px] font-semibold tracking-tight",children:"Routing insights"}),(0,a.jsxs)("p",{className:"text-xs font-mono text-text-subtle",children:["combo: ",s,o?.strategy?.routerModel?` \xb7 router ${o.strategy.routerModel}`:"",o?.strategy?.objective?` \xb7 ${o.strategy.objective}`:"",o?.strategy?.explorationRate!=null?` \xb7 ε=${Math.round((o.strategy.explorationRate??.05)*100)}% (cap ${Math.round((o.strategy.explorationRateCap??.2)*100)}%)`:""]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[(0,a.jsxs)("select",{value:T,onChange:e=>P(Number(e.target.value)||14),className:"text-[11.5px] font-mono text-text-subtle px-2 py-1.5 rounded-[7px] bg-surface-2 border border-border",title:"Date range",children:[(0,a.jsx)("option",{value:7,children:"last 7 days"}),(0,a.jsx)("option",{value:14,children:"last 14 days"}),(0,a.jsx)("option",{value:30,children:"last 30 days"}),(0,a.jsx)("option",{value:90,children:"last 90 days"})]}),(0,a.jsxs)("select",{value:z,onChange:e=>W(e.target.value),className:"text-[11.5px] font-mono text-text-subtle px-2 py-1.5 rounded-[7px] bg-surface-2 border border-border max-w-[140px]",title:"Filter cluster",children:[(0,a.jsx)("option",{value:"",children:"all clusters"}),(o?.clusters||[]).map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsxs)("select",{value:Z,onChange:e=>J(e.target.value),className:"text-[11.5px] font-mono text-text-subtle px-2 py-1.5 rounded-[7px] bg-surface-2 border border-border max-w-[160px]",title:"Filter worker",children:[(0,a.jsx)("option",{value:"",children:"all workers"}),(o?.workers||[]).map(e=>(0,a.jsx)("option",{value:e,children:e.split("/").pop()},e))]}),(0,a.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:I,onChange:e=>K(e.target.checked)}),"exploration only"]}),(0,a.jsx)(N.$n,{size:"sm",variant:"secondary",onClick:q,disabled:$,children:"Refresh"}),(0,a.jsx)(N.$n,{size:"sm",disabled:$,onClick:async()=>{E("");try{let e=await fetch("/api/routing/learn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboName:s})}),t=await e.json();E(t.message||JSON.stringify(t)),await q()}catch(e){E(e.message)}},children:"Relearn now"}),(0,a.jsx)(n(),{href:"/dashboard/combos",className:"text-xs text-text-muted hover:text-primary px-2 py-1.5",children:"← Combos"})]})]}),A&&(0,a.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:A}),_&&(0,a.jsx)("p",{className:"text-sm text-red-400",children:_}),$&&!o&&(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Loading…"}),o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,a.jsx)(O,{label:"Requests",value:String(o.eventCount??0)}),(0,a.jsx)(O,{label:"Need for learn",value:o.needMore>0?`${o.needMore} more`:"ready"}),(0,a.jsx)(O,{label:"Active version",value:o.promoted?`v${o.promoted.version}`:"—"}),(0,a.jsx)(O,{label:"Eval score",value:o.promoted?.evalScore!=null?Number(o.promoted.evalScore).toFixed(1):"—"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[(0,a.jsx)(O,{label:"Router-skip %",value:null==er?"—":`${er}%`}),(0,a.jsx)(O,{label:"Avg score",value:el>0?(eo/el).toFixed(1):"—"}),(0,a.jsx)(O,{label:"Judge coverage %",value:null==ei?"—":`${ei}%`}),(0,a.jsx)(O,{label:"Total picks",value:String(ea)})]}),(0,a.jsxs)("p",{className:"text-[11px] text-text-subtle font-mono -mt-2",children:["Request-level counts (one per chat). Intermediate fallback attempts",null!=o.attemptCount&&o.attemptCount!==o.eventCount?` (${o.attemptCount} attempt rows)`:""," ","feed the bandit but not the min-events gate. Single-worker and heuristic shortcuts are not logged here."]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1 flex-wrap gap-2",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Win-rate heatmap"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[10.5px] font-mono text-text-subtle",children:[(0,a.jsx)("span",{children:"low"}),(0,a.jsx)("span",{className:"w-[120px] h-2 rounded",style:{background:"linear-gradient(90deg,rgba(229,180,84,.1),rgba(229,180,84,.72))"}}),(0,a.jsx)("span",{children:"high \xb7 number always shown"})]})]}),(0,a.jsx)("p",{className:"text-[11.5px] font-mono text-text-subtle mb-3",children:"cluster \xd7 worker \xb7 average outcome score (0–100)"}),o.clusters?.length&&o.workers?.length?(0,a.jsxs)("div",{className:"grid gap-1 overflow-x-auto",style:{gridTemplateColumns:`112px repeat(${o.workers.length}, minmax(56px, 1fr))`},children:[(0,a.jsx)("div",{}),o.workers.map(e=>(0,a.jsx)("div",{className:"font-mono text-[10.5px] text-text-muted text-center pb-1 truncate",title:e,children:e.split("/").pop()},e)),o.heatmap.map(e=>(0,a.jsxs)("div",{className:"contents",children:[(0,a.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-text-muted flex items-center font-medium",children:e.cluster}),e.cells.map(t=>{let s=t.avg,r=null==s||B<=0?0:Math.min(1,s/B);return(0,a.jsx)("div",{className:"rounded text-center font-mono text-[11px] py-2 border border-border",style:{background:`rgba(229,180,84,${.08+.55*r})`,color:null==s?"#6F6653":"#ECE4D2"},title:`${t.worker}: n=${t.n}`,children:null==s?"—":Math.round(s)},`${e.cluster}-${t.worker}`)})]},e.cluster))]}):(0,a.jsx)("p",{className:"text-sm text-text-muted py-6 text-center",children:"No routing events yet. Point a client at this combo with strategy Auto."})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Score trend"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-2",children:"mean outcome score per worker per day (request-level)"}),0===ee.length?(0,a.jsx)("p",{className:"text-xs text-text-muted py-6 text-center",children:"No routing data in this window — Auto combos learn as they route"}):(0,a.jsx)(i.u,{width:"100%",height:220,children:(0,a.jsxs)(c.b,{data:ee,margin:{top:8,right:12,left:0,bottom:0},children:[(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,a.jsx)(x.W,{dataKey:"day",tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickFormatter:e=>String(e).slice(5),tickLine:!1,axisLine:!1}),(0,a.jsx)(m.h,{domain:[0,100],tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1,width:32}),(0,a.jsx)(p.m,{contentStyle:w,itemStyle:{color:"var(--color-text)"},labelStyle:{color:"var(--color-text-muted)"},formatter:(e,t)=>[Math.round(Number(e)),t]}),et.length>=2&&(0,a.jsx)(u.s,{formatter:e=>(0,a.jsx)("span",{className:"font-mono text-[10px] text-text-muted",children:e})}),et.map(e=>(0,a.jsx)(h.N1,{type:"monotone",dataKey:t=>t[e]??null,name:"Other"===e?"Other":e.split("/").pop(),stroke:"Other"===e?v:G[e],strokeWidth:2,dot:!1,activeDot:{r:4},connectNulls:!0,isAnimationActive:!1},e))]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Worker comparison"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-3",children:"average outcome score (0–100)"}),0===V.length?(0,a.jsx)("p",{className:"text-xs text-text-muted py-6 text-center",children:"No routing data in this window — Auto combos learn as they route"}):(0,a.jsx)(i.u,{width:"100%",height:Math.max(180,34*V.length),children:(0,a.jsxs)(b.E,{data:V,layout:"vertical",margin:{top:2,right:34,left:0,bottom:0},children:[(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.1,horizontal:!1}),(0,a.jsx)(x.W,{type:"number",domain:[0,100],tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(m.h,{type:"category",dataKey:"workerLabel",width:110,tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(p.m,{content:(0,a.jsx)(S,{}),contentStyle:w}),(0,a.jsxs)(j.yP,{dataKey:"avgScore",name:"Average score",barSize:16,radius:[0,4,4,0],isAnimationActive:!1,children:[V.map(e=>(0,a.jsx)(g.f,{fill:G[e.worker]||v},e.worker)),(0,a.jsx)(f.Ze,{dataKey:"avgScore",position:"right",formatter:e=>Math.round(Number(e)||0),fill:"var(--color-text-muted)",className:"font-mono"})]})]})})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Pick source"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-3",children:"terminal selections in the selected window"}),0===ea?(0,a.jsx)("p",{className:"text-xs text-text-muted py-6 text-center",children:"No routing data in this window — Auto combos learn as they route"}):(0,a.jsx)(i.u,{width:"100%",height:180,children:(0,a.jsxs)(b.E,{data:[{name:"window",...es}],margin:{top:8,right:8,left:0,bottom:0},children:[(0,a.jsx)(d.d,{strokeDasharray:"3 3",strokeOpacity:.1,vertical:!1}),(0,a.jsx)(x.W,{type:"number",tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(m.h,{type:"category",dataKey:"name",width:48,tick:{className:"font-mono",fill:"currentColor",fillOpacity:.65,fontSize:10},tickLine:!1,axisLine:!1}),(0,a.jsx)(p.m,{contentStyle:w,itemStyle:{color:"var(--color-text)"},labelStyle:{color:"var(--color-text-muted)"}}),(0,a.jsx)(u.s,{formatter:e=>(0,a.jsx)("span",{className:"font-mono text-[10px] text-text-muted",children:e})}),k.map((e,t)=>(0,a.jsx)(j.yP,{dataKey:e.key,name:e.label,stackId:"s",fill:t<6?y[t]:v,isAnimationActive:!1},e.key))]})})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Model performance"}),(0,a.jsxs)("div",{className:"mt-3 space-y-2",children:[0===(o.modelStats||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No data"}),(o.modelStats||[]).map(e=>(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_52px_60px_40px] gap-2 items-center text-xs",children:[(0,a.jsx)("span",{className:"font-mono truncate text-text-main",title:e.worker,children:e.worker}),(0,a.jsx)("span",{className:"text-right font-mono text-text-muted",children:null!=e.avgScore?Math.round(e.avgScore):"—"}),(0,a.jsx)("span",{className:"text-right font-mono text-text-muted",children:null!=e.avgLatencyMs?`${Math.round(e.avgLatencyMs)}ms`:"—"}),(0,a.jsx)("span",{className:"text-right font-mono text-text-subtle",children:e.errors||0})]},e.worker))]})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Learning versions"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-2",children:"immutable \xb7 rollback-safe"}),(0,a.jsxs)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[0===(o.versions||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No versions yet"}),(o.versions||[]).map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs border-b border-border py-1.5",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"font-mono text-text-main",children:["v",e.version,e.promoted?" \xb7 active":""]}),(0,a.jsxs)("div",{className:"text-[10px] text-text-subtle font-mono",children:["eval ",null!=e.evalScore?Number(e.evalScore).toFixed(1):"—"," \xb7"," ",e.source]})]}),!e.promoted&&(0,a.jsx)("button",{type:"button",className:"text-primary text-[11px] hover:underline",onClick:async()=>{await fetch("/api/routing/versions/promote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.id})}),q()},children:"Promote"})]},e.id))]}),o.promoted?.prevVersionId&&(0,a.jsx)(N.$n,{size:"sm",variant:"outline",className:"mt-3",onClick:async()=>{await fetch("/api/routing/versions/rollback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboName:s})}),q()},children:"Rollback"})]})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Recent decisions"}),(0,a.jsxs)("div",{className:"mt-3 overflow-x-auto",children:[(0,a.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,a.jsx)("thead",{className:"text-text-subtle font-mono uppercase tracking-wide",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"py-1 pr-2",children:"Time"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Cluster"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Worker"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Score"}),(0,a.jsx)("th",{className:"py-1 pr-2",children:"Reason"}),(0,a.jsx)("th",{className:"py-1",children:"Rate"})]})}),(0,a.jsx)("tbody",{children:(o.recent||[]).map(e=>{let t=e.meta?.userRating??null;return(0,a.jsxs)("tr",{className:"border-t border-border",children:[(0,a.jsxs)("td",{className:"py-1.5 pr-2 font-mono text-text-muted whitespace-nowrap",children:[e.timestamp?.slice(0,19)?.replace("T"," "),e.meta?.exploration?(0,a.jsx)("span",{className:"ml-1 text-[9px] text-primary",children:"ε"}):null,e.meta?.judgeScore!=null?(0,a.jsxs)("span",{className:"ml-1 text-[9px] text-text-subtle",title:`LLM-judge score ${e.meta.judgeScore}/10`,children:["J",e.meta.judgeScore]}):null]}),(0,a.jsx)("td",{className:"py-1.5 pr-2",children:e.cluster||"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-2 font-mono truncate max-w-[160px]",title:e.pickedWorker,children:e.pickedWorker?.split("/").pop()||"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-2 font-mono",children:null!=e.outcomeScore?Math.round(e.outcomeScore):"—"}),(0,a.jsx)("td",{className:"py-1.5 pr-2 text-text-muted truncate max-w-[240px]",title:e.routerReason,children:e.routerReason||"—"}),(0,a.jsx)("td",{className:"py-1.5 whitespace-nowrap",children:e.requestId?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,a.jsx)("button",{type:"button",title:"Good route",className:`text-[13px] leading-none ${1===t?"text-primary":"text-text-subtle hover:text-primary"}`,onClick:()=>D(e.requestId,+(1!==t)),children:"▲"}),(0,a.jsx)("button",{type:"button",title:"Bad route",className:`text-[13px] leading-none ${-1===t?"text-red-400":"text-text-subtle hover:text-red-400"}`,onClick:()=>D(e.requestId,-1===t?0:-1),children:"▼"})]}):(0,a.jsx)("span",{className:"text-[10px] text-text-subtle",children:"—"})})]},e.id)})})]}),!(o.recent||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted py-4 text-center",children:"No decisions logged"})]})]}),(0,a.jsxs)(N.Zp,{padding:"md",children:[(0,a.jsx)("span",{className:"text-[13px] font-semibold",children:"Exploration log"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle font-mono mb-2",children:"epsilon-greedy random picks (meta.exploration)"}),(0,a.jsxs)("div",{className:"space-y-1.5 max-h-48 overflow-y-auto",children:[0===(o.explorationLog||[]).length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No exploration events in this window"}),(o.explorationLog||[]).map(e=>(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px] font-mono border-b border-border py-1",children:[(0,a.jsx)("span",{className:"text-text-muted",children:e.timestamp?.slice(0,19)?.replace("T"," ")}),(0,a.jsx)("span",{children:e.cluster||"—"}),(0,a.jsx)("span",{className:"text-primary",children:e.pickedWorker?.split("/").pop()}),(0,a.jsxs)("span",{className:"text-text-subtle",children:["score ",null!=e.outcomeScore?Math.round(e.outcomeScore):"—"]})]},`ex-${e.id}`))]})]})]})]}):(0,a.jsxs)("div",{className:"max-w-lg space-y-3",children:[(0,a.jsx)("h1",{className:"text-[17px] font-semibold",children:"Routing insights"}),(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Open from a combo card with strategy ",(0,a.jsx)("strong",{children:"Auto"}),", or append"," ",(0,a.jsx)("code",{className:"text-xs",children:"?combo=your-combo"}),"."]}),(0,a.jsx)(n(),{href:"/dashboard/combos",className:"text-sm text-primary hover:underline",children:"← Combos"})]})}function O({label:e,value:t}){return(0,a.jsxs)("div",{className:"rounded-[11px] border border-border bg-surface p-3.5",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle mb-1.5",children:e}),(0,a.jsx)("div",{className:"font-mono text-[18px] font-semibold text-text-main",children:t})]})}},63759:(e,t,s)=>{Promise.resolve().then(s.bind(s,61872))}},e=>{e.O(0,[2574,3862,782,8500,594,136,1321,7592,5497,8441,3794,7358],()=>e(e.s=63759)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[712],{44493:(e,t,l)=>{"use strict";l.d(t,{default:()=>o});var s=l(95155),n=l(12115),r=l(35497),a=l(90620),c=l(78559);let i={LOG:"text-green-400",INFO:"text-blue-400",WARN:"text-yellow-400",ERROR:"text-red-400",DEBUG:"text-purple-400"};function o(){let[e,t]=(0,n.useState)([]),[l,o]=(0,n.useState)(!1),u=(0,n.useRef)(null),x=async()=>{try{await fetch("/api/translator/console-logs",{method:"DELETE"})}catch(e){(0,c.s)("Failed to clear console logs:",e)}};return(0,n.useEffect)(()=>{let e=new EventSource("/api/translator/console-logs/stream");return e.onopen=()=>o(!0),e.onmessage=e=>{let l=JSON.parse(e.data);"init"===l.type?t(l.logs.slice(-a.UY.maxLines)):"line"===l.type?t(e=>{let t=[...e,l.line];return t.length>a.UY.maxLines?t.slice(-a.UY.maxLines):t}):"lines"===l.type?t(e=>{let t=[...e,...l.lines];return t.length>a.UY.maxLines?t.slice(-a.UY.maxLines):t}):"clear"===l.type&&t([])},e.onerror=()=>o(!1),()=>e.close()},[]),(0,n.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[e]),(0,s.jsx)("div",{className:"",children:(0,s.jsxs)(r.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-end px-4 pt-3 pb-2",children:(0,s.jsx)(r.$n,{size:"sm",variant:"outline",icon:"delete",onClick:x,children:"Clear"})}),(0,s.jsx)("div",{ref:u,className:"bg-black rounded-b-lg p-4 text-xs font-mono h-[calc(100vh-220px)] overflow-y-auto",children:0===e.length?(0,s.jsx)("span",{className:"text-text-muted",children:"No console logs yet."}):(0,s.jsx)("div",{className:"space-y-0.5",children:e.map((e,t)=>{let l,n;return(0,s.jsx)("div",{children:(n=i[(l=e.match(/\[(\w+)\]/g))?l[1]?.replace(/\[|\]/g,""):null]||"text-green-400",(0,s.jsx)("span",{className:n,children:e}))},t)})})})]})})}},63131:(e,t,l)=>{Promise.resolve().then(l.bind(l,44493))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=63131)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[712],{44493:(e,t,l)=>{"use strict";l.d(t,{default:()=>o});var s=l(95155),n=l(12115),r=l(35497),a=l(90620),c=l(78559);let i={LOG:"text-green-400",INFO:"text-blue-400",WARN:"text-yellow-400",ERROR:"text-red-400",DEBUG:"text-purple-400"};function o(){let[e,t]=(0,n.useState)([]),[l,o]=(0,n.useState)(!1),u=(0,n.useRef)(null),x=async()=>{try{await fetch("/api/translator/console-logs",{method:"DELETE"})}catch(e){(0,c.s)("Failed to clear console logs:",e)}};return(0,n.useEffect)(()=>{let e=new EventSource("/api/translator/console-logs/stream");return e.onopen=()=>o(!0),e.onmessage=e=>{let l=JSON.parse(e.data);"init"===l.type?t(l.logs.slice(-a.UY.maxLines)):"line"===l.type?t(e=>{let t=[...e,l.line];return t.length>a.UY.maxLines?t.slice(-a.UY.maxLines):t}):"lines"===l.type?t(e=>{let t=[...e,...l.lines];return t.length>a.UY.maxLines?t.slice(-a.UY.maxLines):t}):"clear"===l.type&&t([])},e.onerror=()=>o(!1),()=>e.close()},[]),(0,n.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[e]),(0,s.jsx)("div",{className:"",children:(0,s.jsxs)(r.Zp,{children:[(0,s.jsx)("div",{className:"flex items-center justify-end px-4 pt-3 pb-2",children:(0,s.jsx)(r.$n,{size:"sm",variant:"outline",icon:"delete",onClick:x,children:"Clear"})}),(0,s.jsx)("div",{ref:u,className:"bg-black rounded-b-lg p-4 text-xs font-mono h-[calc(100vh-220px)] overflow-y-auto",children:0===e.length?(0,s.jsx)("span",{className:"text-text-muted",children:"No console logs yet."}):(0,s.jsx)("div",{className:"space-y-0.5",children:e.map((e,t)=>{let l,n;return(0,s.jsx)("div",{children:(n=i[(l=e.match(/\[(\w+)\]/g))?l[1]?.replace(/\[|\]/g,""):null]||"text-green-400",(0,s.jsx)("span",{className:n,children:e}))},t)})})})]})})}},63131:(e,t,l)=>{Promise.resolve().then(l.bind(l,44493))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=63131)),_N_E=e.O()}]);
@@ -0,0 +1,3 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6099],{53390:(e,t,s)=>{"use strict";s.d(t,{$:()=>o,s:()=>r});var i=s(31967),a=s(99190),n=s(9846),r=class extends a.k{#e;#t;#s;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#s=e.mutationCache,this.#t=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#s.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=(0,n.II)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,s):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});let i="pending"===this.state.status,a=!this.#i.canStart();try{if(i)t();else{this.#a({type:"pending",variables:e,isPaused:a}),this.#s.config.onMutate&&await this.#s.config.onMutate(e,this,s);let t=await this.options.onMutate?.(e,s);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let n=await this.#i.start();return await this.#s.config.onSuccess?.(n,e,this.state.context,this,s),await this.options.onSuccess?.(n,e,this.state.context,s),await this.#s.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,e,this.state.context,s),this.#a({type:"success",data:n}),n}catch(t){try{await this.#s.config.onError?.(t,e,this.state.context,this,s)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,s)}catch(e){Promise.reject(e)}try{await this.#s.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,s)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,s)}catch(e){Promise.reject(e)}throw this.#a({type:"error",error:t}),t}finally{this.#s.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),i.jG.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#s.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},53427:(e,t,s)=>{Promise.resolve().then(s.bind(s,92323))},92323:(e,t,s)=>{"use strict";s.d(t,{default:()=>C});var i=s(95155),a=s(12115),n=s(14051),r=s.n(n),o=s(35625),l=s(4109),c=s(53390),u=s(31967),d=s(98216),h=s(5858),m=class extends d.Q{#e;#n=void 0;#r;#o;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#l()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,h.f8)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,h.EN)(t.mutationKey)!==(0,h.EN)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#l(),this.#c(e)}getCurrentResult(){return this.#n}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#l(),this.#c()}mutate(e,t){return this.#o=t,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#l(){let e=this.#r?.state??(0,c.$)();this.#n={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#c(e){u.jG.batch(()=>{if(this.#o&&this.hasListeners()){let t=this.#n.variables,s=this.#n.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#o.onSuccess?.(e.data,t,s,i)}catch(e){Promise.reject(e)}try{this.#o.onSettled?.(e.data,null,t,s,i)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#o.onError?.(e.error,t,s,i)}catch(e){Promise.reject(e)}try{this.#o.onSettled?.(void 0,e.error,t,s,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#n)})})}};function p(e,t){let s=(0,o.jE)(t),[i]=a.useState(()=>new m(s,e));a.useEffect(()=>{i.setOptions(e)},[i,e]);let n=a.useSyncExternalStore(a.useCallback(e=>i.subscribe(u.jG.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),r=a.useCallback((e,t)=>{i.mutate(e,t).catch(h.lQ)},[i]);if(n.error&&(0,h.GU)(i.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:r,mutateAsync:n.mutate}}var y=s(35497),x=s(11059);function b({label:e,url:t,copyId:s,copied:a,onCopy:n,badge:r,actions:o}){return(0,i.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,i.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center border ${"CF"===r||"TS"===r?"bg-primary/10 text-primary border-primary/25":"bg-surface-2 text-text-muted border-border"}`,children:e}),(0,i.jsx)(y.pd,{value:t,readOnly:!0,className:"flex-1 min-w-0",inputClassName:"font-mono text-sm"}),(0,i.jsx)("button",{type:"button",onClick:()=>n(t,s),className:"p-2 hover:bg-surface-2 rounded text-text-muted hover:text-primary transition-colors shrink-0 border border-transparent hover:border-border",title:"Copy","aria-label":"Copy endpoint URL",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-none",children:a===s?"check":"content_copy"})}),o]})}function f({message:e,action:t}){return(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-brand-500/10 border border-brand-500/30 text-brand-400",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] shrink-0 leading-none",children:"warning"}),(0,i.jsx)("p",{className:"text-xs flex-1 text-brand-300",children:e}),t&&(0,i.jsx)("a",{href:t.href,className:"text-xs font-medium underline shrink-0 hover:opacity-80",onClick:t.href.startsWith("#")?e=>{e.preventDefault(),document.getElementById(t.href.slice(1))?.scrollIntoView({behavior:"smooth"})}:void 0,children:t.label})]})}let v=()=>["endpoint","keys"],g=()=>["endpoint","settings"];async function j(e,t){let s=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers||{}},credentials:"same-origin"}),i=null;try{i=await s.json()}catch{i=null}if(!s.ok){let e=i&&(i.error||i.message)||`Request failed (${s.status})`,t=Error("string"==typeof e?e:"Request failed");throw t.status=s.status,t.data=i,t}return i}var k=s(65921);function C({initialData:e}){let t=(0,o.jE)(),s=e?.machineId||"",n=(0,k.i)(e=>e.error),r=(0,l.I)({queryKey:v(),queryFn:async()=>(await j("/api/keys")).keys||[],initialData:e?.keys||[]}),c=(0,l.I)({queryKey:g(),queryFn:()=>j("/api/settings"),initialData:e?.settings||{}}),u=r.data||[],d=c.data?.requireApiKey===!0,[h,m]=(0,a.useState)(!1),[N,w]=(0,a.useState)(""),[P,S]=(0,a.useState)(null),[A,O]=(0,a.useState)(null),[I,R]=(0,a.useState)(()=>new Set),[E,M]=(0,a.useState)("/v1");(0,a.useEffect)(()=>{M(`${window.location.origin}/v1`)},[]);let{copied:K,copy:q}=(0,x.C)(),F=p({mutationFn:e=>j("/api/settings",{method:"PATCH",body:JSON.stringify({requireApiKey:e})}),onSuccess:()=>{t.invalidateQueries({queryKey:g()})},onError:()=>n("Failed to update API key requirement")}),$=p({mutationFn:e=>j("/api/keys",{method:"POST",body:JSON.stringify({name:e})}),onSuccess:e=>{S(e.key||null),w(""),m(!1),t.invalidateQueries({queryKey:v()})},onError:()=>n("Failed to create API key")}),_=p({mutationFn:e=>j(`/api/keys/${e}`,{method:"DELETE"}),onSuccess:()=>{t.invalidateQueries({queryKey:v()})},onError:()=>n("Failed to delete API key")}),D=p({mutationFn:({id:e,isActive:t})=>j(`/api/keys/${e}`,{method:"PUT",body:JSON.stringify({isActive:t})}),onSuccess:()=>{t.invalidateQueries({queryKey:v()})},onError:()=>n("Failed to toggle API key")});return(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsxs)(y.Zp,{children:[(0,i.jsxs)("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary",children:"api"}),"API Endpoint"]}),(0,i.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Local OpenAI-compatible base URL for coding agents and SDKs. Switchboard is local-only — no tunnels or remote exposure."}),(0,i.jsx)(b,{label:"Local",url:E,copyId:"local_url",copied:K,onCopy:q}),s?(0,i.jsxs)("p",{className:"mt-3 text-xs text-text-muted font-mono",children:["Machine: ",s]}):null]}),(0,i.jsxs)(y.Zp,{id:"require-api-key",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary",children:"vpn_key"}),"API Keys"]}),(0,i.jsx)(y.$n,{icon:"add",onClick:()=>m(!0),children:"Create Key"})]}),(0,i.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"Requests without a valid key will be rejected"})]}),(0,i.jsx)(y.lM,{checked:d,onChange:()=>{d?O({title:"Disable API key protection?",message:"Any client that can reach this Switchboard endpoint will be able to use your provider accounts.",onConfirm:()=>{O(null),F.mutate(!1)}}):F.mutate(!0)}})]}),!d&&(0,i.jsx)("div",{className:"mb-4 -mt-2",children:(0,i.jsx)(f,{message:"API key is not required — any local client can call /v1."})}),0===u.length?(0,i.jsxs)("div",{className:"text-center py-12",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"vpn_key"})}),(0,i.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No API keys yet"}),(0,i.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create your first API key to get started"}),(0,i.jsx)(y.$n,{icon:"add",onClick:()=>m(!0),children:"Create Key"})]}):(0,i.jsx)("div",{className:"flex flex-col",children:u.map(e=>{var t;return(0,i.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===e.isActive?"opacity-60":""}`,children:[(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono",children:I.has(e.id)?e.key:(t=e.key)&&!(t.length<=10)?t.slice(0,6)+"•".repeat(t.length-10)+t.slice(-4):t||""}),(0,i.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void R(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",title:I.has(e.id)?"Hide key":"Show key",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:I.has(e.id)?"visibility_off":"visibility"})}),(0,i.jsx)("button",{type:"button",onClick:()=>q(e.key,e.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:K===e.id?"check":"content_copy"})})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(e.createdAt).toLocaleDateString()]}),!1===e.isActive&&(0,i.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(y.lM,{size:"sm",checked:e.isActive??!0,onChange:t=>{if(e.isActive&&!t){let s=e.name?.trim()||e.id;O({title:"Pause API Key",message:`Pause API key "${s}"?
2
+
3
+ This key will stop working immediately but can be resumed later.`,onConfirm:async()=>{O(null),D.mutate({id:e.id,isActive:t})}})}else D.mutate({id:e.id,isActive:t})},title:e.isActive?"Pause key":"Resume key"}),(0,i.jsx)("button",{type:"button",onClick:()=>O({title:"Delete API Key",message:`Delete API key "${e.name?.trim()||e.id}"?`,onConfirm:async()=>{O(null),_.mutate(e.id)}}),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,i.jsx)(y.aF,{isOpen:h,title:"Create API Key",onClose:()=>{m(!1),w("")},children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(y.pd,{label:"Key Name",value:N,onChange:e=>w(e.target.value),placeholder:"Production Key"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(y.$n,{onClick:()=>$.mutate(N.trim()),fullWidth:!0,disabled:!N.trim()||$.isPending,loading:$.isPending,children:"Create"}),(0,i.jsx)(y.$n,{onClick:()=>{m(!1),w("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,i.jsx)(y.aF,{isOpen:!!P,title:"API Key Created",onClose:()=>S(null),children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,i.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,i.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(y.pd,{value:P||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,i.jsx)(y.$n,{variant:"secondary",icon:"created_key"===K?"check":"content_copy",onClick:()=>q(P,"created_key"),children:"created_key"===K?"Copied!":"Copy"})]}),(0,i.jsx)(y.$n,{onClick:()=>S(null),fullWidth:!0,children:"Done"})]})}),(0,i.jsx)(y.uo,{isOpen:!!A,onClose:()=>O(null),onConfirm:A?.onConfirm,title:A?.title||"Confirm",message:A?.message,variant:"danger"})]})}C.propTypes={initialData:r().shape({machineId:r().string,keys:r().array,settings:r().object}).isRequired}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=53427)),_N_E=e.O()}]);
@@ -56,4 +56,4 @@
56
56
  -F "temperature=${k}"`:""}${p.includes("prompt")&&g?` \\
57
57
  -F "prompt=${g}"`:""}`,V=async()=>{if(!x||!z)return;M(!0),L(""),R(null);let e=Date.now();try{let t=new FormData;t.append("file",x),t.append("model",z),p.includes("language")&&b&&t.append("language",b),p.includes("response_format")&&t.append("response_format",w),p.includes("temperature")&&k&&t.append("temperature",k),p.includes("prompt")&&g&&t.append("prompt",g);let s={};$&&(s.Authorization=`Bearer ${$}`);let a=await fetch("/api/v1/audio/transcriptions",{method:"POST",headers:s,body:t});_(Date.now()-e);let r=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok)return void L(r?.error?.message||r?.error||r||`HTTP ${a.status}`);R(r)}catch(e){L(e.message||"Network error")}finally{M(!1)}},H="string"==typeof P?P:P?JSON.stringify(P,null,2):`{
58
58
  "text": "Hello world..."
59
- }`;return(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[l.length>0?(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("select",{value:d,onChange:e=>m(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:l.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("input",{value:d,onChange:e=>m(e.target.value),placeholder:"Enter model id",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)(C,{label:"Endpoint",children:(0,a.jsx)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:(0,a.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[A,"/v1/audio/transcriptions"]})})}),(0,a.jsx)(C,{label:"API Key",children:(0,a.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:$?`${$.slice(0,8)}${"•".repeat(Math.min(20,$.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),(0,a.jsx)(C,{label:"Audio File",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("input",{type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>h(e.target.files?.[0]||null),className:"w-full text-xs text-text-muted file:mr-2 file:py-1 file:px-2.5 file:rounded-lg file:border file:border-border file:bg-background file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),x&&(0,a.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[x.name," \xb7 ",(x.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,a.jsx)(C,{label:"Language",children:(0,a.jsx)("input",{value:b,onChange:e=>f(e.target.value),placeholder:"e.g. en, vi, ja (auto-detect if empty)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),p.includes("prompt")&&(0,a.jsx)(C,{label:"Prompt",children:(0,a.jsx)("input",{value:g,onChange:e=>j(e.target.value),placeholder:"optional context to improve accuracy",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),p.includes("temperature")&&(0,a.jsx)(C,{label:"Temperature",children:(0,a.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>S(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),p.includes("response_format")&&(0,a.jsx)(C,{label:"Response Format",children:(0,a.jsxs)("select",{value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"json",children:"json"}),(0,a.jsx)("option",{value:"text",children:"text"}),(0,a.jsx)("option",{value:"srt",children:"srt"}),(0,a.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,a.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("button",{onClick:()=>D(J),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:B?"check":"content_copy"}),B?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:V,disabled:O||!x||!z,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:O?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),O?"Transcribing...":"Run"]})]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:J})]}),F&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:F}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",P&&I&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",I,"ms"]})]}),P&&(0,a.jsxs)("button",{onClick:()=>q(H),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:U?"check":"content_copy"}),U?"Copied":"Copy"]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:H})]})]})]})}var L=s(77251);function B(){let{kind:e,id:t}=(0,r.useParams)(),s=(0,r.useRouter)(),o=c.rj.find(t=>t.id===e),m=(0,c.gC)(t)&&"embedding"===e,u=async()=>{if(await (0,L.l)({message:"Delete this Custom Embedding node?",confirmText:"Continue"}))try{(await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"})).ok&&s.push(`/dashboard/media-providers/${e}`)}catch(e){(0,j.s)("Error deleting custom embedding node:",e)}},[p,x]=(0,n.useState)(null),[h,b]=(0,n.useState)(m),[f,y]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!m)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(s=>{e||(x((s.nodes||[]).find(e=>e.id===t)||null),b(!1))}).catch(()=>{e||b(!1)}),()=>{e=!0}},[t,m]),!o)return(0,r.notFound)();let v=c.Q2[t],w=m?p?{id:t,name:p.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:v;if(!m&&!v||m&&!h&&!p)return(0,r.notFound)();if(m&&h)return(0,a.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let N=m?["embedding"]:w.serviceKinds??["llm"];return m||N.includes(e)?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(l(),{href:`/dashboard/media-providers/${e}`,className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),o.label]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[(0,a.jsx)("div",{className:"size-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${w.color}15`},children:(0,a.jsx)(d.A,{src:`/providers/${w.id}.png`,alt:w.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:w.textIcon||w.id.slice(0,2).toUpperCase(),fallbackColor:w.color})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:w.name}),!m&&w.notice?.apiKeyUrl&&(0,a.jsxs)("a",{href:w.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[m&&(0,a.jsxs)(i.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",p?.prefix]}),N.map(t=>(0,a.jsx)(i.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),m&&(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>y(!0),children:"Edit"}),(0,a.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:u,children:"Delete"})]})]})]}),!m&&w.kindNotice?.[e]&&(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] mt-0.5",children:"warning"}),(0,a.jsx)("p",{className:"text-sm",children:w.kindNotice[e]})]}),!m&&w.notice?.text&&!w.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:w.notice.text}),w.notice.apiKeyUrl&&(0,a.jsx)("a",{href:w.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),!m&&w.noAuth?(0,a.jsx)(i.gw,{providerId:t}):(0,a.jsx)(g,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,a.jsx)(k,{providerId:t,kindFilter:e,providerAliasOverride:m?p?.prefix:void 0}),!m&&(w.searchConfig||w.fetchConfig||w.ttsConfig||w.sttConfig||w.embeddingConfig||w.searchViaChat)&&(0,a.jsx)(i.Wx,{config:"webFetch"===e?w.fetchConfig:"tts"===e?w.ttsConfig:"stt"===e?w.sttConfig:"embedding"===e?w.embeddingConfig:w.searchConfig||{mode:"chat-completions",defaultModel:w.searchViaChat?.defaultModel,pricingUrl:w.searchViaChat?.pricingUrl,freeTier:w.searchViaChat?.freeTier},provider:w,title:`${o.label} Config`}),"embedding"===e&&(0,a.jsx)(E,{providerId:t,customAlias:p?.prefix}),"tts"===e&&(0,a.jsx)(I,{providerId:t}),"stt"===e&&!m&&(0,a.jsx)(K,{providerId:t}),!m&&S[e]&&(0,a.jsx)(F,{providerId:t,kind:e}),m&&(0,a.jsx)(i.x0,{isOpen:f,node:p,onClose:()=>y(!1),onSaved:e=>{x(e),y(!1)}})]}):(0,r.notFound)()}},70217:(e,t,s)=>{"use strict";function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}s.d(t,{g:()=>a})}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=17845)),_N_E=e.O()}]);
59
+ }`;return(0,a.jsxs)(i.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Example"}),(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[l.length>0?(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("select",{value:d,onChange:e=>m(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:l.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})}):(0,a.jsx)(C,{label:"Model",children:(0,a.jsx)("input",{value:d,onChange:e=>m(e.target.value),placeholder:"Enter model id",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),(0,a.jsx)(C,{label:"Endpoint",children:(0,a.jsx)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:(0,a.jsxs)("span",{className:"w-full min-w-0 flex-1 px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate",children:[A,"/v1/audio/transcriptions"]})})}),(0,a.jsx)(C,{label:"API Key",children:(0,a.jsx)("span",{className:"px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block",children:$?`${$.slice(0,8)}${"•".repeat(Math.min(20,$.length-8))}`:(0,a.jsx)("span",{className:"text-text-muted italic",children:"No key configured"})})}),(0,a.jsx)(C,{label:"Audio File",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("input",{type:"file",accept:"audio/*,video/mp4,.m4a,.mp3,.wav,.ogg,.flac,.webm,.opus",onChange:e=>h(e.target.files?.[0]||null),className:"w-full text-xs text-text-muted file:mr-2 file:py-1 file:px-2.5 file:rounded-lg file:border file:border-border file:bg-background file:text-text-main hover:file:bg-sidebar file:cursor-pointer"}),x&&(0,a.jsxs)("span",{className:"text-xs text-text-muted font-mono",children:[x.name," \xb7 ",(x.size/1024).toFixed(1)," KB"]})]})}),p.includes("language")&&(0,a.jsx)(C,{label:"Language",children:(0,a.jsx)("input",{value:b,onChange:e=>f(e.target.value),placeholder:"e.g. en, vi, ja (auto-detect if empty)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary font-mono"})}),p.includes("prompt")&&(0,a.jsx)(C,{label:"Prompt",children:(0,a.jsx)("input",{value:g,onChange:e=>j(e.target.value),placeholder:"optional context to improve accuracy",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),p.includes("temperature")&&(0,a.jsx)(C,{label:"Temperature",children:(0,a.jsx)("input",{type:"number",step:"0.1",min:"0",max:"1",value:k,onChange:e=>S(e.target.value),placeholder:"0 - 1 (default 0)",className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})}),p.includes("response_format")&&(0,a.jsx)(C,{label:"Response Format",children:(0,a.jsxs)("select",{value:w,onChange:e=>N(e.target.value),className:"w-full px-3 py-1.5 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",children:[(0,a.jsx)("option",{value:"json",children:"json"}),(0,a.jsx)("option",{value:"text",children:"text"}),(0,a.jsx)("option",{value:"srt",children:"srt"}),(0,a.jsx)("option",{value:"verbose_json",children:"verbose_json"}),(0,a.jsx)("option",{value:"vtt",children:"vtt"})]})}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"Request"}),(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsxs)("button",{onClick:()=>D(J),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:B?"check":"content_copy"}),B?"Copied":"Copy"]}),(0,a.jsxs)("button",{onClick:V,disabled:O||!x||!z,className:"flex w-full sm:w-auto items-center justify-center gap-1.5 px-3 py-1 rounded-lg bg-primary text-on-primary text-xs font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",style:O?{animation:"spin 1s linear infinite"}:void 0,children:"play_arrow"}),O?"Transcribing...":"Run"]})]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all",children:J})]}),F&&(0,a.jsx)("p",{className:"text-xs text-red-500 break-words",children:F}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-1.5",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["Response ",P&&I&&(0,a.jsxs)("span",{className:"font-normal normal-case",children:["⚡ ",I,"ms"]})]}),P&&(0,a.jsxs)("button",{onClick:()=>q(H),className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:U?"check":"content_copy"}),U?"Copied":"Copy"]})]}),(0,a.jsx)("pre",{className:"bg-sidebar rounded-lg px-3 py-2.5 text-xs font-mono text-text-main overflow-x-auto whitespace-pre-wrap break-all opacity-70",children:H})]})]})]})}var L=s(77251);function B(){let{kind:e,id:t}=(0,r.useParams)(),s=(0,r.useRouter)(),o=c.rj.find(t=>t.id===e),m=(0,c.gC)(t)&&"embedding"===e,u=async()=>{if(await (0,L.l)({message:"Delete this Custom Embedding node?",confirmText:"Continue"}))try{(await fetch(`/api/provider-nodes/${t}`,{method:"DELETE"})).ok&&s.push(`/dashboard/media-providers/${e}`)}catch(e){(0,j.s)("Error deleting custom embedding node:",e)}},[p,x]=(0,n.useState)(null),[h,b]=(0,n.useState)(m),[f,y]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{if(!m)return;let e=!1;return fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(s=>{e||(x((s.nodes||[]).find(e=>e.id===t)||null),b(!1))}).catch(()=>{e||b(!1)}),()=>{e=!0}},[t,m]),!o)return(0,r.notFound)();let v=c.Q2[t],w=m?p?{id:t,name:p.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"}:null:v;if(!m&&!v||m&&!h&&!p)return(0,r.notFound)();if(m&&h)return(0,a.jsx)("div",{className:"text-text-muted text-sm py-12 text-center",children:"Loading..."});let N=m?["embedding"]:w.serviceKinds??["llm"];return m||N.includes(e)?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)(l(),{href:`/dashboard/media-providers/${e}`,className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),o.label]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[(0,a.jsx)("div",{className:"size-12 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${w.color}15`},children:(0,a.jsx)(d.A,{src:`/providers/${w.id}.png`,alt:w.name,size:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",fallbackText:w.textIcon||w.id.slice(0,2).toUpperCase(),fallbackColor:w.color})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,a.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:w.name}),!m&&w.notice?.apiKeyUrl&&(0,a.jsxs)("a",{href:w.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-1 flex-wrap",children:[m&&(0,a.jsxs)(i.Ex,{variant:"default",size:"sm",children:["Custom \xb7 ",p?.prefix]}),N.map(t=>(0,a.jsx)(i.Ex,{variant:t===e?"primary":"default",size:"sm",children:t.toUpperCase()},t))]})]}),m&&(0,a.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center",children:[(0,a.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>y(!0),children:"Edit"}),(0,a.jsx)(i.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:u,children:"Delete"})]})]})]}),!m&&w.kindNotice?.[e]&&(0,a.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px] mt-0.5",children:"warning"}),(0,a.jsx)("p",{className:"text-sm",children:w.kindNotice[e]})]}),!m&&w.notice?.text&&!w.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:w.notice.text}),w.notice.apiKeyUrl&&(0,a.jsx)("a",{href:w.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),!m&&w.noAuth?(0,a.jsx)(i.gw,{providerId:t}):(0,a.jsx)(g,{providerId:t,isOAuth:!1}),"tts"!==e&&"webSearch"!==e&&"webFetch"!==e&&(0,a.jsx)(k,{providerId:t,kindFilter:e,providerAliasOverride:m?p?.prefix:void 0}),!m&&(w.searchConfig||w.fetchConfig||w.ttsConfig||w.sttConfig||w.embeddingConfig||w.searchViaChat)&&(0,a.jsx)(i.Wx,{config:"webFetch"===e?w.fetchConfig:"tts"===e?w.ttsConfig:"stt"===e?w.sttConfig:"embedding"===e?w.embeddingConfig:w.searchConfig||{mode:"chat-completions",defaultModel:w.searchViaChat?.defaultModel,pricingUrl:w.searchViaChat?.pricingUrl,freeTier:w.searchViaChat?.freeTier},provider:w,title:`${o.label} Config`}),"embedding"===e&&(0,a.jsx)(E,{providerId:t,customAlias:p?.prefix}),"tts"===e&&(0,a.jsx)(I,{providerId:t}),"stt"===e&&!m&&(0,a.jsx)(K,{providerId:t}),!m&&S[e]&&(0,a.jsx)(F,{providerId:t,kind:e}),m&&(0,a.jsx)(i.x0,{isOpen:f,node:p,onClose:()=>y(!1),onSaved:e=>{x(e),y(!1)}})]}):(0,r.notFound)()}},70217:(e,t,s)=>{"use strict";function a(e,t){return!1===e?"default":"active"===t||"success"===t?"success":"error"===t||"expired"===t||"unavailable"===t?"error":"default"}s.d(t,{g:()=>a})}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=17845)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6620],{16144:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>g});var r=t(95155),a=t(73321),i=t(98500),n=t.n(i),d=t(12115),o=t(35497),l=t(57250),c=t(88105),m=t(54026),x=t(78559);let h=new Set([]),p={image:"image-combo",tts:"tts-combo"};function b(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function u({provider:e,kind:s,connections:t,isCustom:a,onToggle:i}){let d=c.Q2[e.id],m=!!d?.noAuth,x=t.filter(s=>s.provider===e.id),h=x.filter(e=>{let s=b(e);return"active"===s||"success"===s}).length,p=x.filter(e=>{let s=b(e);return"error"===s||"expired"===s||"unavailable"===s}).length,f=x.length,g=f>0&&x.every(e=>!1===e.isActive);return(0,r.jsx)(n(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,r.jsx)(o.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${g?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,r.jsx)(l.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[a&&(0,r.jsx)(o.Ex,{variant:"default",size:"sm",children:"Custom"}),m?(0,r.jsx)(o.Ex,{variant:"success",size:"sm",children:"Ready"}):g?(0,r.jsx)(o.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===f?(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[h>0&&(0,r.jsxs)(o.Ex,{variant:"success",size:"sm",dot:!0,children:[h," Connected"]}),p>0&&(0,r.jsxs)(o.Ex,{variant:"error",size:"sm",dot:!0,children:[p," Error"]}),0===h&&0===p&&(0,r.jsxs)(o.Ex,{variant:"default",size:"sm",children:[f," Added"]})]})]})]})]}),f>0&&(0,r.jsx)("div",{className:"shrink-0 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:s=>{s.preventDefault(),s.stopPropagation(),i&&i(e.id,g)},children:(0,r.jsx)(o.lM,{size:"sm",checked:!g,onChange:()=>{},title:g?"Enable provider":"Disable provider"})})]})})})}function f({combos:e}){return 0===e.length?null:(0,r.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,r.jsx)(n(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,r.jsx)(o.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,r.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",a=c.Q2[t];return(0,r.jsx)("div",{title:a?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${a?.color??"#888"}15`},children:(0,r.jsx)(l.A,{src:`/providers/${t}.png`,alt:a?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:a?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:a?.color})},`${e}-${s}`)}),e.models.length>6&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function g(){let{kind:e}=(0,a.useParams)(),s=(0,a.useRouter)(),[t,i]=(0,d.useState)([]),[n,l]=(0,d.useState)([]),[b,g]=(0,d.useState)([]),[v,j]=(0,d.useState)(!1);(0,d.useEffect)(()=>{("webSearch"===e||"webFetch"===e)&&s.replace("/dashboard/media-providers/web")},[e,s]);let N=c.rj.find(s=>s.id===e),y="embedding"===e,k=h.has(e);if((0,d.useEffect)(()=>{N&&(fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>i(e.connections||[])).catch(()=>{}),y&&fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(e=>l((e.nodes||[]).filter(e=>"custom-embedding"===e.type))).catch(()=>{}),k&&fetch("/api/combos",{cache:"no-store"}).then(e=>e.json()).then(e=>g(e.combos||[])).catch(()=>{}))},[y,k,N]),!N)return(0,a.notFound)();let w=(0,c.o5)(e),C=b.filter(s=>s.kind===e),$=n.map(e=>({id:e.id,name:e.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"})),E=[...w,...$],S=async(e,s)=>{let r=t.filter(s=>s.provider===e);i(t=>t.map(t=>t.provider===e?{...t,isActive:s}:t)),await Promise.allSettled(r.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})))},z=async()=>{let t=p[e]||`${e}-combo`,r=t,a=1,i=new Set(b.map(e=>e.name));for(;i.has(r);)r=`${t}-${a++}`;let n=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,models:[],kind:e})});if(n.ok){let e=await n.json();s.push(`/dashboard/media-providers/combo/${e.id}`)}else{let e=await n.json();(0,x.s)(e.error||"Failed to create combo")}};return(0,r.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:N.label}),(0,r.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"Media providers \xb7 not agent Skills"})]}),(0,r.jsx)(m.A,{activeKind:e}),(y||k)&&(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[k&&(0,r.jsx)(o.$n,{size:"sm",icon:"add",onClick:z,children:"Create Combo"}),y&&(0,r.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>j(!0),children:"Add Custom Embedding"})]}),k&&C.length>0&&(0,r.jsx)(f,{combos:C}),0===E.length?(0,r.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-text-muted text-sm",children:["No providers support ",(0,r.jsx)("strong",{children:N.label})," yet."]}):(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[w.map(s=>(0,r.jsx)(u,{provider:s,kind:e,connections:t,onToggle:S},s.id)),$.map(s=>(0,r.jsx)(u,{provider:s,kind:e,connections:t,isCustom:!0,onToggle:S},s.id))]}),y&&(0,r.jsx)(o.x0,{isOpen:v,onClose:()=>j(!1),onCreated:e=>{l(s=>[...s,e]),j(!1)}})]})}},54026:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});var r=t(95155),a=t(98500),i=t.n(a),n=t(73321),d=t(31474);let o=[{id:"image",label:"Image",href:"/dashboard/media-providers/image"},{id:"tts",label:"TTS",href:"/dashboard/media-providers/tts"},{id:"stt",label:"STT",href:"/dashboard/media-providers/stt"},{id:"embedding",label:"Embedding",href:"/dashboard/media-providers/embedding"},{id:"web",label:"Web",href:"/dashboard/media-providers/web"}];function l({activeKind:e}){let s=(0,n.usePathname)(),t=e||o.find(e=>s===e.href||s.startsWith(`${e.href}/`))?.id||"";return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mb-5",children:[(0,r.jsx)(i(),{href:"/dashboard/media-providers",className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors","/dashboard/media-providers"===s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:"All"}),o.map(e=>{let s=t===e.id;return(0,r.jsx)(i(),{href:e.href,className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors",s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:e.label},e.id)})]})}},61493:(e,s,t)=>{Promise.resolve().then(t.bind(t,16144))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=61493)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6620],{16144:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>g});var r=t(95155),a=t(73321),i=t(98500),n=t.n(i),d=t(12115),o=t(35497),l=t(57250),c=t(88105),m=t(54026),x=t(78559);let h=new Set([]),p={image:"image-combo",tts:"tts-combo"};function b(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function u({provider:e,kind:s,connections:t,isCustom:a,onToggle:i}){let d=c.Q2[e.id],m=!!d?.noAuth,x=t.filter(s=>s.provider===e.id),h=x.filter(e=>{let s=b(e);return"active"===s||"success"===s}).length,p=x.filter(e=>{let s=b(e);return"error"===s||"expired"===s||"unavailable"===s}).length,f=x.length,g=f>0&&x.every(e=>!1===e.isActive);return(0,r.jsx)(n(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,r.jsx)(o.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${g?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,r.jsx)(l.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[a&&(0,r.jsx)(o.Ex,{variant:"default",size:"sm",children:"Custom"}),m?(0,r.jsx)(o.Ex,{variant:"success",size:"sm",children:"Ready"}):g?(0,r.jsx)(o.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===f?(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[h>0&&(0,r.jsxs)(o.Ex,{variant:"success",size:"sm",dot:!0,children:[h," Connected"]}),p>0&&(0,r.jsxs)(o.Ex,{variant:"error",size:"sm",dot:!0,children:[p," Error"]}),0===h&&0===p&&(0,r.jsxs)(o.Ex,{variant:"default",size:"sm",children:[f," Added"]})]})]})]})]}),f>0&&(0,r.jsx)("div",{className:"shrink-0 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:s=>{s.preventDefault(),s.stopPropagation(),i&&i(e.id,g)},children:(0,r.jsx)(o.lM,{size:"sm",checked:!g,onChange:()=>{},title:g?"Enable provider":"Disable provider"})})]})})})}function f({combos:e}){return 0===e.length?null:(0,r.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,r.jsx)(n(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,r.jsx)(o.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,r.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",a=c.Q2[t];return(0,r.jsx)("div",{title:a?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${a?.color??"#888"}15`},children:(0,r.jsx)(l.A,{src:`/providers/${t}.png`,alt:a?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:a?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:a?.color})},`${e}-${s}`)}),e.models.length>6&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function g(){let{kind:e}=(0,a.useParams)(),s=(0,a.useRouter)(),[t,i]=(0,d.useState)([]),[n,l]=(0,d.useState)([]),[b,g]=(0,d.useState)([]),[v,j]=(0,d.useState)(!1);(0,d.useEffect)(()=>{("webSearch"===e||"webFetch"===e)&&s.replace("/dashboard/media-providers/web")},[e,s]);let N=c.rj.find(s=>s.id===e),y="embedding"===e,k=h.has(e);if((0,d.useEffect)(()=>{N&&(fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>i(e.connections||[])).catch(()=>{}),y&&fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(e=>l((e.nodes||[]).filter(e=>"custom-embedding"===e.type))).catch(()=>{}),k&&fetch("/api/combos",{cache:"no-store"}).then(e=>e.json()).then(e=>g(e.combos||[])).catch(()=>{}))},[y,k,N]),!N)return(0,a.notFound)();let w=(0,c.o5)(e),C=b.filter(s=>s.kind===e),$=n.map(e=>({id:e.id,name:e.name||"Custom Embedding",color:"#6366F1",textIcon:"CE"})),E=[...w,...$],S=async(e,s)=>{let r=t.filter(s=>s.provider===e);i(t=>t.map(t=>t.provider===e?{...t,isActive:s}:t)),await Promise.allSettled(r.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})))},z=async()=>{let t=p[e]||`${e}-combo`,r=t,a=1,i=new Set(b.map(e=>e.name));for(;i.has(r);)r=`${t}-${a++}`;let n=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,models:[],kind:e})});if(n.ok){let e=await n.json();s.push(`/dashboard/media-providers/combo/${e.id}`)}else{let e=await n.json();(0,x.s)(e.error||"Failed to create combo")}};return(0,r.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:N.label}),(0,r.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"Media providers \xb7 not agent Skills"})]}),(0,r.jsx)(m.A,{activeKind:e}),(y||k)&&(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[k&&(0,r.jsx)(o.$n,{size:"sm",icon:"add",onClick:z,children:"Create Combo"}),y&&(0,r.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>j(!0),children:"Add Custom Embedding"})]}),k&&C.length>0&&(0,r.jsx)(f,{combos:C}),0===E.length?(0,r.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-text-muted text-sm",children:["No providers support ",(0,r.jsx)("strong",{children:N.label})," yet."]}):(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[w.map(s=>(0,r.jsx)(u,{provider:s,kind:e,connections:t,onToggle:S},s.id)),$.map(s=>(0,r.jsx)(u,{provider:s,kind:e,connections:t,isCustom:!0,onToggle:S},s.id))]}),y&&(0,r.jsx)(o.x0,{isOpen:v,onClose:()=>j(!1),onCreated:e=>{l(s=>[...s,e]),j(!1)}})]})}},54026:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});var r=t(95155),a=t(98500),i=t.n(a),n=t(73321),d=t(31474);let o=[{id:"image",label:"Image",href:"/dashboard/media-providers/image"},{id:"tts",label:"TTS",href:"/dashboard/media-providers/tts"},{id:"stt",label:"STT",href:"/dashboard/media-providers/stt"},{id:"embedding",label:"Embedding",href:"/dashboard/media-providers/embedding"},{id:"web",label:"Web",href:"/dashboard/media-providers/web"}];function l({activeKind:e}){let s=(0,n.usePathname)(),t=e||o.find(e=>s===e.href||s.startsWith(`${e.href}/`))?.id||"";return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mb-5",children:[(0,r.jsx)(i(),{href:"/dashboard/media-providers",className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors","/dashboard/media-providers"===s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:"All"}),o.map(e=>{let s=t===e.id;return(0,r.jsx)(i(),{href:e.href,className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors",s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:e.label},e.id)})]})}},61493:(e,s,t)=>{Promise.resolve().then(t.bind(t,16144))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=61493)),_N_E=e.O()}]);
@@ -1,4 +1,4 @@
1
1
  (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8334],{22662:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var a=s(95155),l=s(73321),r=s(12115),i=s(98500),n=s.n(i),o=s(35497),d=s(57250),c=s(88105),m=s(78559),x=s(77251),h=s(5772);let u=/^[a-zA-Z0-9_.\-]+$/,p={webSearch:"Web Search",webFetch:"Web Fetch",image:"Text to Image",tts:"Text To Speech"},b={webSearch:"/v1/search",webFetch:"/v1/web/fetch",image:"/v1/images/generations",tts:"/v1/audio/speech"},f={webSearch:e=>({model:e,query:"What is the latest news about AI?",search_type:"web",max_results:5}),webFetch:e=>({model:e,url:"https://example.com",format:"markdown"}),image:e=>({model:e,prompt:"A cute cat playing piano",n:1,size:"1024x1024"}),tts:e=>({model:e,input:"Hello, this is a test.",voice:"alloy"})};function j(e){return"webSearch"===e||"webFetch"===e?"/dashboard/media-providers/web":`/dashboard/media-providers/${e}`}function g(){let{id:e}=(0,l.useParams)(),t=(0,l.useRouter)(),[s,i]=(0,r.useState)(null),[g,w]=(0,r.useState)(!0),[y,v]=(0,r.useState)(""),[N,k]=(0,r.useState)(""),[S,U]=(0,r.useState)([]),[$,C]=(0,r.useState)(!1),[O,_]=(0,r.useState)(!1),[T,R]=(0,r.useState)([]),[A,L]=(0,r.useState)(!1),[P,z]=(0,r.useState)(null),[E,D]=(0,r.useState)(""),[F,M]=(0,r.useState)(""),[I,J]=(0,r.useState)([]),[W,H]=(0,r.useState)({}),Z=async()=>{try{let[t,s,a,l,r,n]=await Promise.all([fetch(`/api/combos/${e}`,{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"}),fetch("/api/usage/logs",{cache:"no-store"}),fetch("/api/keys",{cache:"no-store"}),fetch("/api/providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]);if(n.ok&&H((await n.json()).aliases||{}),l.ok){let e=await l.json();M((e.keys||[]).find(e=>!1!==e.isActive)?.key||"")}if(r.ok&&J((await r.json()).connections||[]),!t.ok){i(null),w(!1);return}let o=await t.json();i(o),v(o.name),U(o.models||[]);let d=s.ok?await s.json():{};C(d.comboStrategies?.[o.name]?.fallbackStrategy==="round-robin");let c=a.ok?await a.json():[];R(c.filter(e=>"string"==typeof e&&e.includes(o.name)).slice(0,50))}catch{}w(!1)};(0,r.useEffect)(()=>{Z()},[e]);let q=e=>e.trim()?u.test(e)?(k(""),!0):(k("Only letters, numbers, -, _ and ."),!1):(k("Name is required"),!1),B=async t=>{let s=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok){let e=await s.json();return(0,m.s)(e.error||"Failed to save"),!1}return!0},Y=async()=>{!q(y)||y===s.name||await B({name:y})&&await Z()},G=async e=>{let t=e?.value||e;if(!t||S.includes(t))return;let s=[...S,t];U(s),await B({models:s})},K=async e=>{let t=e?.value||e;if(!t||!S.includes(t))return;let s=S.filter(e=>e!==t);U(s),await B({models:s})},Q=async e=>{let t=S.filter((t,s)=>s!==e);U(t),await B({models:t})},V=async(e,t)=>{let s=[...S],a=e+t;a<0||a>=s.length||([s[e],s[a]]=[s[a],s[e]],U(s),await B({models:s}))},X=async e=>{C(e);let t=await fetch("/api/settings",{cache:"no-store"}),a={...(t.ok?await t.json():{}).comboStrategies||{}};e?a[s.name]={fallbackStrategy:"round-robin"}:delete a[s.name],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:a})})},ee=async()=>{!await (0,x.l)({message:`Delete combo "${s.name?.trim()||e}"?`,confirmText:"Continue"})||(await fetch(`/api/combos/${e}`,{method:"DELETE"})).ok&&t.push(j(s.kind))},et=async()=>{if(L(!0),z(null),D(""),P?.audioUrl)try{URL.revokeObjectURL(P.audioUrl)}catch{}if(P?.imageUrl?.startsWith("blob:"))try{URL.revokeObjectURL(P.imageUrl)}catch{}let e=Date.now();try{let t=b[s.kind],a=f[s.kind](s.name),l={"Content-Type":"application/json"};F&&(l.Authorization=`Bearer ${F}`);let r=await fetch(`/api${t}`,{method:"POST",headers:l,body:JSON.stringify(a)}),i=Date.now()-e;if(!r.ok){let e=await r.json().catch(()=>({}));D(e?.error?.message||e?.error||`HTTP ${r.status}`),z({json:JSON.stringify(e,null,2),latencyMs:i});return}let n=r.headers.get("content-type")||"";if(n.startsWith("image/")){let e=await r.blob();z({imageUrl:URL.createObjectURL(e),latencyMs:i});return}if(n.startsWith("audio/")||"application/octet-stream"===n){let e=await r.blob();z({audioUrl:URL.createObjectURL(e),latencyMs:i});return}let o=await r.json(),d=o?.data?.[0],c=d?.b64_json?`data:image/png;base64,${d.b64_json}`:d?.url||"";z({json:JSON.stringify(function e(t){if(!t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map(e);let s={};for(let[a,l]of Object.entries(t))s[a]="b64_json"===a&&"string"==typeof l&&l.length>100?`<${l.length} chars base64>`:e(l);return s}(o),null,2),imageUrl:c,latencyMs:i})}catch(e){D(e.message||"Network error")}L(!1)};if(g)return(0,a.jsx)("div",{className:"text-text-muted text-sm",children:"Loading..."});if(!s)return(0,l.notFound)();let es=p[s.kind]||c.rj.find(e=>e.id===s.kind)?.label||"Combo",ea=b[s.kind],el=s.kind&&f[s.kind]?f[s.kind](s.name):null,er=ea?`curl -X POST http://localhost:20128${ea} \\
2
2
  -H "Content-Type: application/json" \\
3
3
  -H "Authorization: Bearer ${F||"YOUR_KEY"}" \\
4
- -d '${JSON.stringify(el)}'`:"",ei=j(s.kind);return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)(n(),{href:ei,className:"text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,a.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[es," Combo"]}),(0,a.jsx)("code",{className:"text-lg font-semibold font-mono",children:s.name})]})]}),(0,a.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:ee,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:y,onChange:e=>{v(e.target.value),q(e.target.value)},onBlur:Y,error:N}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,a.jsx)(o.lM,{checked:$,onChange:X})]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>_(!0),children:"Add Provider"})]}),0===S.length?(0,a.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:S.map((e,t)=>{let{providerId:s,model:l}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),r=c.Q2[s];return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,a.jsx)(d.A,{src:`/providers/${s}.png`,alt:r?.name||s,size:24,className:"object-contain rounded shrink-0",fallbackText:r?.textIcon||s.slice(0,2).toUpperCase(),fallbackColor:r?.color}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:r?.name||s}),l&&(0,a.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:l})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:()=>V(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:()=>V(t,1),disabled:t===S.length-1,className:`p-1 rounded ${t===S.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_downward"})}),(0,a.jsx)("button",{onClick:()=>Q(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]},`${e}-${t}`)})})]}),s.kind&&ea&&(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,a.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:et,disabled:A||0===S.length,children:A?"Running...":"Run"})]}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:er}),E&&(0,a.jsx)("p",{className:"mt-3 text-xs text-red-500 break-words",children:E}),P&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=P.latencyMs&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",P.latencyMs,"ms"]}),P.imageUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:P.imageUrl,download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)(h.default,{src:P.imageUrl,alt:"Generated",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border"})]}),P.audioUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:P.audioUrl,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("audio",{controls:!0,src:P.audioUrl,className:"w-full"})]}),P.json&&(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:P.json})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===T.length?(0,a.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:T.join("\n")})]}),(0,a.jsx)(o.rq,{isOpen:O,onClose:()=>_(!1),onSelect:G,onDeselect:K,activeProviders:I,modelAliases:W,title:`Add ${es} Model`,kindFilter:s.kind,addedModelValues:S,closeOnSelect:!1})]})}},69701:(e,t,s)=>{Promise.resolve().then(s.bind(s,22662))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=69701)),_N_E=e.O()}]);
4
+ -d '${JSON.stringify(el)}'`:"",ei=j(s.kind);return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,a.jsx)(n(),{href:ei,className:"text-text-muted hover:text-primary",children:(0,a.jsx)("span",{className:"material-symbols-outlined",children:"arrow_back"})}),(0,a.jsx)("div",{className:"size-10 rounded-lg bg-primary/10 flex items-center justify-center",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"layers"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:[es," Combo"]}),(0,a.jsx)("code",{className:"text-lg font-semibold font-mono",children:s.name})]})]}),(0,a.jsx)(o.$n,{variant:"outline",icon:"delete",onClick:ee,className:"text-red-500 border-red-200 hover:bg-red-50",children:"Delete"})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Settings"}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(o.pd,{label:"Combo Name",value:y,onChange:e=>{v(e.target.value),q(e.target.value)},onBlur:Y,error:N}),(0,a.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and ."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Rotate providers across requests instead of strict fallback order."})]}),(0,a.jsx)(o.lM,{checked:$,onChange:X})]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Providers"}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Tried in order (top-down) or rotated when round-robin is on."})]}),(0,a.jsx)(o.$n,{size:"sm",icon:"add",onClick:()=>_(!0),children:"Add Provider"})]}),0===S.length?(0,a.jsx)("div",{className:"text-center py-6 border border-dashed border-border rounded-lg text-text-muted text-sm",children:"No providers yet."}):(0,a.jsx)("div",{className:"flex flex-col gap-2",children:S.map((e,t)=>{let{providerId:s,model:l}=function(e){if("string"!=typeof e)return{providerId:"",model:""};let t=e.indexOf("/");return t<0?{providerId:e,model:""}:{providerId:e.slice(0,t),model:e.slice(t+1)}}(e),r=c.Q2[s];return(0,a.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02]",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted w-5 text-center",children:t+1}),(0,a.jsx)(d.A,{src:`/providers/${s}.png`,alt:r?.name||s,size:24,className:"object-contain rounded shrink-0",fallbackText:r?.textIcon||s.slice(0,2).toUpperCase(),fallbackColor:r?.color}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:r?.name||s}),l&&(0,a.jsx)("code",{className:"text-[10px] text-text-muted font-mono truncate block",children:l})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{onClick:()=>V(t,-1),disabled:0===t,className:`p-1 rounded ${0===t?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move up",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})}),(0,a.jsx)("button",{onClick:()=>V(t,1),disabled:t===S.length-1,className:`p-1 rounded ${t===S.length-1?"text-text-muted/20":"text-text-muted hover:text-primary hover:bg-black/5"}`,title:"Move down",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_downward"})}),(0,a.jsx)("button",{onClick:()=>Q(t),className:"p-1 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10",title:"Remove",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})]},`${e}-${t}`)})})]}),s.kind&&ea&&(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Test Example"}),(0,a.jsx)(o.$n,{size:"sm",icon:"play_arrow",onClick:et,disabled:A||0===S.length,children:A?"Running...":"Run"})]}),(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-x-auto whitespace-pre-wrap break-all",children:er}),E&&(0,a.jsx)("p",{className:"mt-3 text-xs text-red-500 break-words",children:E}),P&&(0,a.jsxs)("div",{className:"mt-3 flex flex-col gap-3",children:[null!=P.latencyMs&&(0,a.jsxs)("span",{className:"text-[11px] text-text-muted",children:["⚡ ",P.latencyMs,"ms"]}),P.imageUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:P.imageUrl,download:"image.png",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)(h.default,{src:P.imageUrl,alt:"Generated",width:1024,height:1024,unoptimized:!0,className:"max-w-full rounded-lg border border-border"})]}),P.audioUrl&&(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center justify-end mb-1.5",children:(0,a.jsxs)("a",{href:P.audioUrl,download:"speech.mp3",className:"inline-flex items-center gap-1 text-xs text-text-muted hover:text-primary transition-colors",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"download"}),"Download"]})}),(0,a.jsx)("audio",{controls:!0,src:P.audioUrl,className:"w-full"})]}),P.json&&(0,a.jsx)("pre",{className:"text-xs font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[300px] whitespace-pre-wrap break-all",children:P.json})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Usage Logs"}),0===T.length?(0,a.jsx)("p",{className:"text-xs text-text-muted italic",children:"No usage yet."}):(0,a.jsx)("pre",{className:"text-[11px] font-mono bg-black/[0.03] dark:bg-white/[0.03] p-3 rounded-lg overflow-auto max-h-[400px] whitespace-pre-wrap",children:T.join("\n")})]}),(0,a.jsx)(o.rq,{isOpen:O,onClose:()=>_(!1),onSelect:G,onDeselect:K,activeProviders:I,modelAliases:W,title:`Add ${es} Model`,kindFilter:s.kind,addedModelValues:S,closeOnSelect:!1})]})}},69701:(e,t,s)=>{Promise.resolve().then(s.bind(s,22662))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=69701)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9749],{57767:(e,s,i)=>{"use strict";i.r(s),i.d(s,{default:()=>c});var r=i(95155),t=i(98500),l=i.n(t),a=i(35497),d=i(88105);let n=[{id:"image",label:"Text to Image",icon:"brush",blurb:"Image generation providers"},{id:"tts",label:"Text to Speech",icon:"record_voice_over",blurb:"Speech synthesis providers"},{id:"stt",label:"Speech to Text",icon:"mic",blurb:"Transcription providers"},{id:"embedding",label:"Embedding",icon:"data_array",blurb:"Vector embedding providers"},{id:"web",label:"Web Fetch & Search",icon:"travel_explore",blurb:"Search + page fetch providers"}];function c(){return(0,r.jsxs)("div",{className:"flex flex-col gap-5 max-w-3xl",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Media"}),(0,r.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"image \xb7 TTS \xb7 STT \xb7 embeddings \xb7 web — separate from agent Skills"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(e=>{let s=d.rj.find(s=>s.id===e.id);return(0,r.jsx)(l(),{href:`/dashboard/media-providers/${e.id}`,className:"group",children:(0,r.jsx)(a.Zp,{padding:"sm",className:"h-full transition-colors group-hover:border-brand-500/40",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"size-9 rounded-lg bg-brand-500/10 text-primary flex items-center justify-center shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px] leading-none",children:e.icon||s?.icon||"perm_media"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:e.label||s?.label||e.id}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-subtle text-[16px] group-hover:text-primary transition-colors",children:"chevron_right"})]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.blurb})]})]})})},e.id)})})]})}},96434:(e,s,i)=>{Promise.resolve().then(i.bind(i,57767))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=96434)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9749],{57767:(e,s,i)=>{"use strict";i.r(s),i.d(s,{default:()=>c});var r=i(95155),t=i(98500),l=i.n(t),a=i(35497),d=i(88105);let n=[{id:"image",label:"Text to Image",icon:"brush",blurb:"Image generation providers"},{id:"tts",label:"Text to Speech",icon:"record_voice_over",blurb:"Speech synthesis providers"},{id:"stt",label:"Speech to Text",icon:"mic",blurb:"Transcription providers"},{id:"embedding",label:"Embedding",icon:"data_array",blurb:"Vector embedding providers"},{id:"web",label:"Web Fetch & Search",icon:"travel_explore",blurb:"Search + page fetch providers"}];function c(){return(0,r.jsxs)("div",{className:"flex flex-col gap-5 max-w-3xl",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Media"}),(0,r.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"image \xb7 TTS \xb7 STT \xb7 embeddings \xb7 web — separate from agent Skills"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(e=>{let s=d.rj.find(s=>s.id===e.id);return(0,r.jsx)(l(),{href:`/dashboard/media-providers/${e.id}`,className:"group",children:(0,r.jsx)(a.Zp,{padding:"sm",className:"h-full transition-colors group-hover:border-brand-500/40",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"size-9 rounded-lg bg-brand-500/10 text-primary flex items-center justify-center shrink-0",children:(0,r.jsx)("span",{className:"material-symbols-outlined text-[20px] leading-none",children:e.icon||s?.icon||"perm_media"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:e.label||s?.label||e.id}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-subtle text-[16px] group-hover:text-primary transition-colors",children:"chevron_right"})]}),(0,r.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:e.blurb})]})]})})},e.id)})})]})}},96434:(e,s,i)=>{Promise.resolve().then(i.bind(i,57767))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=96434)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9260],{22637:(e,s,t)=>{Promise.resolve().then(t.bind(t,71088))},54026:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(95155),a=t(98500),i=t.n(a),o=t(73321),d=t(31474);let l=[{id:"image",label:"Image",href:"/dashboard/media-providers/image"},{id:"tts",label:"TTS",href:"/dashboard/media-providers/tts"},{id:"stt",label:"STT",href:"/dashboard/media-providers/stt"},{id:"embedding",label:"Embedding",href:"/dashboard/media-providers/embedding"},{id:"web",label:"Web",href:"/dashboard/media-providers/web"}];function n({activeKind:e}){let s=(0,o.usePathname)(),t=e||l.find(e=>s===e.href||s.startsWith(`${e.href}/`))?.id||"";return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mb-5",children:[(0,r.jsx)(i(),{href:"/dashboard/media-providers",className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors","/dashboard/media-providers"===s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:"All"}),l.map(e=>{let s=t===e.id;return(0,r.jsx)(i(),{href:e.href,className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors",s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:e.label},e.id)})]})}},71088:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>u});var r=t(95155),a=t(98500),i=t.n(a),o=t(12115),d=t(73321),l=t(35497),n=t(57250),c=t(88105),m=t(54026),x=t(78559);function h(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function b({provider:e,kind:s,connections:t}){let a=c.Q2[e.id],o=!!a?.noAuth,d=t.filter(s=>s.provider===e.id),m=d.filter(e=>{let s=h(e);return"active"===s||"success"===s}).length,x=d.filter(e=>{let s=h(e);return"error"===s||"expired"===s||"unavailable"===s}).length,p=d.length,f=p>0&&d.every(e=>!1===e.isActive);return(0,r.jsx)(i(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,r.jsx)(l.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${f?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,r.jsx)(n.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,r.jsx)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:o?(0,r.jsx)(l.Ex,{variant:"success",size:"sm",children:"Ready"}):f?(0,r.jsx)(l.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===p?(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[m>0&&(0,r.jsxs)(l.Ex,{variant:"success",size:"sm",dot:!0,children:[m," Connected"]}),x>0&&(0,r.jsxs)(l.Ex,{variant:"error",size:"sm",dot:!0,children:[x," Error"]}),0===m&&0===x&&(0,r.jsxs)(l.Ex,{variant:"default",size:"sm",children:[p," Added"]})]})})]})]})})})}function p({combos:e}){return 0===e.length?(0,r.jsx)("p",{className:"text-xs text-text-muted italic",children:"No combos yet."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,r.jsx)(i(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,r.jsx)(l.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,r.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",a=c.Q2[t];return(0,r.jsx)("div",{title:a?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${a?.color??"#888"}15`},children:(0,r.jsx)(n.A,{src:`/providers/${t}.png`,alt:a?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:a?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:a?.color})},`${e}-${s}`)}),e.models.length>6&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function f({title:e,icon:s,kind:t,providers:a,connections:i,combos:o,onCreateCombo:d}){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary",children:s}),(0,r.jsx)("h2",{className:"text-base font-semibold",children:e}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["(",a.length," providers \xb7 ",o.length," combos)"]})]}),(0,r.jsx)(l.$n,{size:"sm",icon:"add",onClick:d,children:"Create Combo"})]}),o.length>0&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(p,{combos:o})}),0===a.length?(0,r.jsx)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl text-text-muted text-sm",children:"No providers."}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(e=>(0,r.jsx)(b,{provider:e,kind:t,connections:i},e.id))})]})}function u(){let e=(0,d.useRouter)(),[s,t]=(0,o.useState)([]),[a,i]=(0,o.useState)([]),l=async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/combos",{cache:"no-store"})]);e.ok&&t((await e.json()).connections||[]),s.ok&&i((await s.json()).combos||[])}catch{}};(0,o.useEffect)(()=>{l()},[]);let n=(0,c.o5)("webSearch"),h=(0,c.o5)("webFetch"),b=a.filter(e=>"webSearch"===e.kind),p=a.filter(e=>"webFetch"===e.kind),u=async s=>{let t="webSearch"===s?"search-combo":"fetch-combo",r=t,i=1,o=new Set(a.map(e=>e.name));for(;o.has(r);)r=`${t}-${i++}`;let d=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,models:[],kind:s})});if(d.ok){let s=await d.json();e.push(`/dashboard/media-providers/combo/${s.id}`)}else{let e=await d.json();(0,x.s)(e.error||"Failed to create combo")}};return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Web Fetch & Search"}),(0,r.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"Media providers \xb7 not agent Skills"})]}),(0,r.jsx)(m.A,{activeKind:"web"}),(0,r.jsx)(f,{title:"Web Search",icon:"search",kind:"webSearch",providers:n,connections:s,combos:b,onCreateCombo:()=>u("webSearch")}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsx)(f,{title:"Web Fetch",icon:"travel_explore",kind:"webFetch",providers:h,connections:s,combos:p,onCreateCombo:()=>u("webFetch")})]})}}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=22637)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9260],{22637:(e,s,t)=>{Promise.resolve().then(t.bind(t,71088))},54026:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});var r=t(95155),a=t(98500),i=t.n(a),o=t(73321),d=t(31474);let l=[{id:"image",label:"Image",href:"/dashboard/media-providers/image"},{id:"tts",label:"TTS",href:"/dashboard/media-providers/tts"},{id:"stt",label:"STT",href:"/dashboard/media-providers/stt"},{id:"embedding",label:"Embedding",href:"/dashboard/media-providers/embedding"},{id:"web",label:"Web",href:"/dashboard/media-providers/web"}];function n({activeKind:e}){let s=(0,o.usePathname)(),t=e||l.find(e=>s===e.href||s.startsWith(`${e.href}/`))?.id||"";return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mb-5",children:[(0,r.jsx)(i(),{href:"/dashboard/media-providers",className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors","/dashboard/media-providers"===s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:"All"}),l.map(e=>{let s=t===e.id;return(0,r.jsx)(i(),{href:e.href,className:(0,d.cn)("px-2.5 py-1 rounded-[7px] text-xs font-medium border transition-colors",s?"bg-brand-500/15 text-primary border-brand-500/40":"bg-transparent text-text-muted border-border hover:text-text-main hover:border-brand-500/30"),children:e.label},e.id)})]})}},71088:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>u});var r=t(95155),a=t(98500),i=t.n(a),o=t(12115),d=t(73321),l=t(35497),n=t(57250),c=t(88105),m=t(54026),x=t(78559);function h(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function b({provider:e,kind:s,connections:t}){let a=c.Q2[e.id],o=!!a?.noAuth,d=t.filter(s=>s.provider===e.id),m=d.filter(e=>{let s=h(e);return"active"===s||"success"===s}).length,x=d.filter(e=>{let s=h(e);return"error"===s||"expired"===s||"unavailable"===s}).length,p=d.length,f=p>0&&d.every(e=>!1===e.isActive);return(0,r.jsx)(i(),{href:`/dashboard/media-providers/${s}/${e.id}`,className:"group",children:(0,r.jsx)(l.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${f?"opacity-50":""}`,children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,r.jsx)(n.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,r.jsx)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:o?(0,r.jsx)(l.Ex,{variant:"success",size:"sm",children:"Ready"}):f?(0,r.jsx)(l.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===p?(0,r.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,r.jsxs)(r.Fragment,{children:[m>0&&(0,r.jsxs)(l.Ex,{variant:"success",size:"sm",dot:!0,children:[m," Connected"]}),x>0&&(0,r.jsxs)(l.Ex,{variant:"error",size:"sm",dot:!0,children:[x," Error"]}),0===m&&0===x&&(0,r.jsxs)(l.Ex,{variant:"default",size:"sm",children:[p," Added"]})]})})]})]})})})}function p({combos:e}){return 0===e.length?(0,r.jsx)("p",{className:"text-xs text-text-muted italic",children:"No combos yet."}):(0,r.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,r.jsx)(i(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,r.jsx)(l.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,r.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",a=c.Q2[t];return(0,r.jsx)("div",{title:a?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${a?.color??"#888"}15`},children:(0,r.jsx)(n.A,{src:`/providers/${t}.png`,alt:a?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:a?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:a?.color})},`${e}-${s}`)}),e.models.length>6&&(0,r.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,r.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function f({title:e,icon:s,kind:t,providers:a,connections:i,combos:o,onCreateCombo:d}){return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:"material-symbols-outlined text-primary",children:s}),(0,r.jsx)("h2",{className:"text-base font-semibold",children:e}),(0,r.jsxs)("span",{className:"text-xs text-text-muted",children:["(",a.length," providers \xb7 ",o.length," combos)"]})]}),(0,r.jsx)(l.$n,{size:"sm",icon:"add",onClick:d,children:"Create Combo"})]}),o.length>0&&(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(p,{combos:o})}),0===a.length?(0,r.jsx)("div",{className:"text-center py-8 border border-dashed border-border rounded-xl text-text-muted text-sm",children:"No providers."}):(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(e=>(0,r.jsx)(b,{provider:e,kind:t,connections:i},e.id))})]})}function u(){let e=(0,d.useRouter)(),[s,t]=(0,o.useState)([]),[a,i]=(0,o.useState)([]),l=async()=>{try{let[e,s]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/combos",{cache:"no-store"})]);e.ok&&t((await e.json()).connections||[]),s.ok&&i((await s.json()).combos||[])}catch{}};(0,o.useEffect)(()=>{l()},[]);let n=(0,c.o5)("webSearch"),h=(0,c.o5)("webFetch"),b=a.filter(e=>"webSearch"===e.kind),p=a.filter(e=>"webFetch"===e.kind),u=async s=>{let t="webSearch"===s?"search-combo":"fetch-combo",r=t,i=1,o=new Set(a.map(e=>e.name));for(;o.has(r);)r=`${t}-${i++}`;let d=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,models:[],kind:s})});if(d.ok){let s=await d.json();e.push(`/dashboard/media-providers/combo/${s.id}`)}else{let e=await d.json();(0,x.s)(e.error||"Failed to create combo")}};return(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Web Fetch & Search"}),(0,r.jsx)("p",{className:"text-xs font-mono text-text-subtle",children:"Media providers \xb7 not agent Skills"})]}),(0,r.jsx)(m.A,{activeKind:"web"}),(0,r.jsx)(f,{title:"Web Search",icon:"search",kind:"webSearch",providers:n,connections:s,combos:b,onCreateCombo:()=>u("webSearch")}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsx)(f,{title:"Web Fetch",icon:"travel_explore",kind:"webFetch",providers:h,connections:s,combos:p,onCreateCombo:()=>u("webFetch")})]})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=22637)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6607],{23879:(e,s,t)=>{"use strict";t.d(s,{default:()=>d});var a=t(95155),i=t(12115),n=t(3534),l=t(28777),o=t(88105),r=t(21402);function d(){let[e,s]=(0,i.useState)([]),[t,d]=(0,i.useState)([]),[c,u]=(0,i.useState)({}),[h,p]=(0,i.useState)(!1),[w,f]=(0,i.useState)(null),[y,x]=(0,i.useState)({running:!1,certExists:!1,dnsStatus:{},hasCachedPassword:!1});(0,i.useEffect)(()=>{g(),v(),m(),S()},[]);let g=async()=>{try{let e=await fetch("/api/providers");if(e.ok){let t=await e.json();s(t.connections||[])}}catch{}},v=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let s=await e.json();d(s.keys||[])}}catch{}},m=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let s=await e.json();u(s.aliases||{})}}catch{}},S=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();p(s.cloudEnabled||!1)}}catch{}},b=()=>e.filter(e=>!1!==e.isActive),k=Object.entries(n.wn);return(0,a.jsxs)("div",{className:"flex w-full flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:"⚠️ MITM intercepts HTTPS traffic of IDE tools (Antigravity, GitHub Copilot, Kiro) via local CA to redirect requests to your providers. May violate ToS → account ban. Use at your own risk."})]}),(0,a.jsx)(r.tA,{apiKeys:t,cloudEnabled:h,onStatusChange:x}),(0,a.jsx)("div",{className:"grid gap-3 sm:gap-4",children:k.map(([e,s])=>(0,a.jsx)(r.kn,{tool:s,isExpanded:w===e,onToggle:()=>f(w===e?null:e),serverRunning:y.running,dnsActive:y.dnsStatus?.[e]||!1,hasCachedPassword:y.hasCachedPassword||!1,needsSudoPassword:!1!==y.needsSudoPassword,isWin:!0===y.isWin,apiKeys:t,activeProviders:b(),hasActiveProviders:b().some(e=>(0,l.KC)(e.provider).length>0||(0,o.mq)(e.provider)||(0,o.gb)(e.provider)),modelAliases:c,cloudEnabled:h,onDnsChange:e=>x(s=>({...s,dnsStatus:e.dnsStatus??s.dnsStatus}))},e))})]})}},82831:(e,s,t)=>{Promise.resolve().then(t.bind(t,23879))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,2493,8441,3794,7358],()=>e(e.s=82831)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6607],{23879:(e,s,t)=>{"use strict";t.d(s,{default:()=>d});var a=t(95155),i=t(12115),n=t(3534),l=t(28777),o=t(88105),r=t(21402);function d(){let[e,s]=(0,i.useState)([]),[t,d]=(0,i.useState)([]),[c,u]=(0,i.useState)({}),[h,p]=(0,i.useState)(!1),[w,f]=(0,i.useState)(null),[y,x]=(0,i.useState)({running:!1,certExists:!1,dnsStatus:{},hasCachedPassword:!1});(0,i.useEffect)(()=>{g(),v(),m(),S()},[]);let g=async()=>{try{let e=await fetch("/api/providers");if(e.ok){let t=await e.json();s(t.connections||[])}}catch{}},v=async()=>{try{let e=await fetch("/api/keys");if(e.ok){let s=await e.json();d(s.keys||[])}}catch{}},m=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let s=await e.json();u(s.aliases||{})}}catch{}},S=async()=>{try{let e=await fetch("/api/settings");if(e.ok){let s=await e.json();p(s.cloudEnabled||!1)}}catch{}},b=()=>e.filter(e=>!1!==e.isActive),k=Object.entries(n.wn);return(0,a.jsxs)("div",{className:"flex w-full flex-col gap-6",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:"⚠️ MITM intercepts HTTPS traffic of IDE tools (Antigravity, GitHub Copilot, Kiro) via local CA to redirect requests to your providers. May violate ToS → account ban. Use at your own risk."})]}),(0,a.jsx)(r.tA,{apiKeys:t,cloudEnabled:h,onStatusChange:x}),(0,a.jsx)("div",{className:"grid gap-3 sm:gap-4",children:k.map(([e,s])=>(0,a.jsx)(r.kn,{tool:s,isExpanded:w===e,onToggle:()=>f(w===e?null:e),serverRunning:y.running,dnsActive:y.dnsStatus?.[e]||!1,hasCachedPassword:y.hasCachedPassword||!1,needsSudoPassword:!1!==y.needsSudoPassword,isWin:!0===y.isWin,apiKeys:t,activeProviders:b(),hasActiveProviders:b().some(e=>(0,l.KC)(e.provider).length>0||(0,o.mq)(e.provider)||(0,o.gb)(e.provider)),modelAliases:c,cloudEnabled:h,onDnsChange:e=>x(s=>({...s,dnsStatus:e.dnsStatus??s.dnsStatus}))},e))})]})}},82831:(e,s,t)=>{Promise.resolve().then(t.bind(t,23879))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,2493,8441,3794,7358],()=>e(e.s=82831)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{12151:(e,t,s)=>{"use strict";s.d(t,{default:()=>b});var a=s(95155),r=s(12115),o=s(35497),i=s(81127),l=s(21931),n=s(1620),d=s(31474),c=s(90620),m=s(93308),x=s(38202),u=s(65921);function b({initialData:e}){let{theme:t,setTheme:s,isDark:p}=(0,n.D)(),h=(0,u.i)(e=>e.error),[y,g]=(0,r.useState)("en"),[f,j]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[v,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(e?.settings||{fallbackStrategy:"fill-first"}),[P,T]=(0,r.useState)(!e?.settings),[R,O]=(0,r.useState)(!1),[E,L]=(0,r.useState)({type:"",message:""}),$=(0,r.useRef)(null),[U,A]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""}),[F,H]=(0,r.useState)({type:"",message:""}),[J,_]=(0,r.useState)(!1),[D,M]=(0,r.useState)(!1);(0,r.useEffect)(()=>{g(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${m.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,m.QC)(t)}())},[f]),(0,r.useEffect)(()=>{let t=e?.settings||C;A({outboundProxyEnabled:t?.outboundProxyEnabled===!0,outboundProxyUrl:t?.outboundProxyUrl||"",outboundNoProxy:t?.outboundNoProxy||""}),T(!1)},[e]);let I=async e=>{if(e.preventDefault(),!0===C.outboundProxyEnabled){_(!0),H({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyUrl:U.outboundProxyUrl,outboundNoProxy:U.outboundNoProxy})}),t=await e.json();e.ok?(S(e=>({...e,...t})),H({type:"success",message:"Proxy settings applied"})):H({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){H({type:"error",message:"An error occurred"})}finally{_(!1)}}},Z=async()=>{if(!0!==C.outboundProxyEnabled)return;let e=(U.outboundProxyUrl||"").trim();if(!e)return void H({type:"error",message:"Please enter a Proxy URL to test"});M(!0),H({type:"",message:""});try{let t=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:e})}),s=await t.json();t.ok&&s?.ok?H({type:"success",message:`Proxy test OK (${s.status}) in ${s.elapsedMs}ms`}):H({type:"error",message:s?.error||"Proxy test failed"})}catch(e){H({type:"error",message:"An error occurred"})}finally{M(!1)}},q=async e=>{_(!0),H({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),s=await t.json();t.ok?(S(e=>({...e,...s})),A(e=>({...e,outboundProxyEnabled:s?.outboundProxyEnabled===!0})),H({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):H({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){H({type:"error",message:"An error occurred"})}finally{_(!1)}},z=async e=>{try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})});if(t.ok)S(t=>({...t,fallbackStrategy:e}));else throw Error(`HTTP ${t.status}`)}catch(e){h("Failed to update settings")}},B=async e=>{try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})});if(t.ok)S(t=>({...t,comboStrategy:e}));else throw Error(`HTTP ${t.status}`)}catch(e){h("Failed to update combo strategy")}},Q=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})});if(e.ok)S(e=>({...e,stickyRoundRobinLimit:t}));else throw Error(`HTTP ${e.status}`)}catch(e){h("Failed to update sticky limit")}},W=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStickyRoundRobinLimit:t})});if(e.ok)S(e=>({...e,comboStickyRoundRobinLimit:t}));else throw Error(`HTTP ${e.status}`)}catch(e){h("Failed to update combo sticky limit")}},K=async e=>{try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableObservability:e})});if(t.ok)S(t=>({...t,enableObservability:e}));else throw Error(`HTTP ${t.status}`)}catch(e){h("Failed to update observability setting")}},G=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();S(t)}catch(e){h("Failed to reload settings")}},V=async()=>{O(!0),L({type:"",message:""});try{let e=await fetch("/api/settings/database");if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Failed to export database")}let t=await e.json(),s=JSON.stringify(t,null,2),a=new Blob([s],{type:"application/json"}),r=URL.createObjectURL(a),o=document.createElement("a"),i=new Date().toISOString().replace(/[.:]/g,"-");o.href=r,o.download=`switchboard-backup-${i}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r),L({type:"success",message:"Database backup downloaded"})}catch(e){L({type:"error",message:e.message||"Failed to export database"})}finally{O(!1)}},X=async e=>{let t=e.target.files?.[0];if($.current&&($.current.value=""),t){O(!0),L({type:"",message:""});try{let e=await t.text(),s=JSON.parse(e),a=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),r=await a.json().catch(()=>({}));if(!a.ok)throw Error(r.error||"Failed to import database");await G(),L({type:"success",message:"Database imported successfully"})}catch(e){L({type:"error",message:e.message||"Invalid backup file"})}finally{O(!1)}}},Y=!0===C.enableObservability,ee=async()=>{k(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}k(!1),w(!1)};return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto px-4 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"size-10 sm:size-12 rounded-lg bg-green-500/10 text-green-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl sm:text-2xl",children:"computer"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg sm:text-xl font-semibold",children:"Local Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Running on your machine"})]})]}),(0,a.jsx)("div",{className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5 w-full sm:w-auto",children:["light","dark","system"].map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>s(e),className:(0,d.cn)("flex items-center justify-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1.5 rounded-md font-medium transition-all flex-1 sm:flex-initial",t===e?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"light"===e?"light_mode":"dark"===e?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize text-xs sm:text-sm",children:e})]},e))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-3 rounded-lg bg-bg border border-border gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Database Location"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted font-mono break-all",children:"~/.switchboard/db/data.sqlite"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(o.$n,{variant:"secondary",icon:"download",onClick:()=>V(),loading:R,className:"w-full sm:w-auto",children:"Download Backup"}),(0,a.jsx)(o.$n,{variant:"outline",icon:"upload",onClick:()=>$.current?.click(),disabled:R,className:"w-full sm:w-auto",children:"Import Backup"}),(0,a.jsx)("input",{ref:$,type:"file",accept:"application/json,.json",className:"hidden",onChange:X})]}),E.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===E.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:E.message})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg bg-blue-500/10 text-blue-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Language"})]}),(0,a.jsxs)("button",{onClick:()=>j(!0),className:"flex items-center justify-between w-full p-3 rounded-lg bg-bg border border-border hover:border-primary/50 transition-colors","data-i18n-skip":"true",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Display language"}),(0,a.jsx)("span",{className:"text-2xl",children:x.h[y]||"\uD83C\uDF10"})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"route"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Routing Strategy"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through accounts to distribute load"})]}),(0,a.jsx)(o.lM,{checked:"round-robin"===C.fallbackStrategy,onChange:()=>z("round-robin"===C.fallbackStrategy?"fill-first":"round-robin"),disabled:P})]}),"round-robin"===C.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Calls per account before switching"})]}),(0,a.jsx)(o.pd,{type:"number",min:"1",max:"10",value:C.stickyRoundRobinLimit||3,onChange:e=>Q(e.target.value),disabled:P,className:"w-16 sm:w-20 text-center shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(o.lM,{checked:"round-robin"===C.comboStrategy,onChange:()=>B("round-robin"===C.comboStrategy?"fallback":"round-robin"),disabled:P})]}),"round-robin"===C.comboStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Calls per combo model before switching"})]}),(0,a.jsx)(o.pd,{type:"number",min:"1",max:"100",value:C.comboStickyRoundRobinLimit||1,onChange:e=>W(e.target.value),disabled:P,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["round-robin"===C.fallbackStrategy?`Currently distributing requests across all available accounts with ${C.stickyRoundRobinLimit||3} calls per account.`:"Currently using accounts in priority order (Fill First).","round-robin"===C.comboStrategy?` Combos rotate after ${C.comboStickyRoundRobinLimit||1} call${1===(C.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"wifi"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Network"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(o.lM,{checked:!0===C.outboundProxyEnabled,onChange:()=>q(!0!==C.outboundProxyEnabled),disabled:P||J})]}),!0===C.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:I,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Proxy URL"}),(0,a.jsx)(o.pd,{placeholder:"http://127.0.0.1:7897",value:U.outboundProxyUrl,onChange:e=>A(t=>({...t,outboundProxyUrl:e.target.value})),disabled:P||J}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"No Proxy"}),(0,a.jsx)(o.pd,{placeholder:"localhost,127.0.0.1",value:U.outboundNoProxy,onChange:e=>A(t=>({...t,outboundNoProxy:e.target.value})),disabled:P||J}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[(0,a.jsx)(o.$n,{type:"button",variant:"secondary",loading:D,disabled:P||J,onClick:Z,className:"w-full sm:w-auto",children:"Test proxy URL"}),(0,a.jsx)(o.$n,{type:"submit",variant:"primary",loading:J,className:"w-full sm:w-auto",children:"Apply"})]})]}),F.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===F.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:F.message})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"monitoring"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Observability"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Enable Observability"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Record request details for inspection in the logs view"})]}),(0,a.jsx)(o.lM,{checked:Y,onChange:K,disabled:P})]})]}),(0,a.jsx)("div",{className:"flex flex-col sm:flex-row gap-2",children:(0,a.jsx)(o.$n,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>w(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})}),(0,a.jsxs)("div",{className:"text-center text-xs sm:text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[c.vQ.name," v",c.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:"Local Mode - All data stored on your machine"})]})]}),(0,a.jsx)(l.default,{hideTrigger:!0,isOpen:f,onClose:e=>{j(!1),g(e)}}),(0,a.jsx)(i.ConfirmModal,{isOpen:N,onClose:()=>w(!1),onConfirm:ee,title:"Shutdown",message:"Are you sure you want to close the proxy server?",confirmText:"Shutdown",cancelText:"Cancel",variant:"danger",loading:v})]})}},34743:(e,t,s)=>{Promise.resolve().then(s.bind(s,12151))}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=34743)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{12151:(e,t,s)=>{"use strict";s.d(t,{default:()=>b});var a=s(95155),r=s(12115),o=s(35497),i=s(81127),l=s(21931),n=s(1620),d=s(31474),c=s(90620),m=s(93308),x=s(38202),u=s(65921);function b({initialData:e}){let{theme:t,setTheme:s,isDark:p}=(0,n.D)(),h=(0,u.i)(e=>e.error),[y,g]=(0,r.useState)("en"),[f,j]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),[v,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(e?.settings||{fallbackStrategy:"fill-first"}),[P,T]=(0,r.useState)(!e?.settings),[R,O]=(0,r.useState)(!1),[E,L]=(0,r.useState)({type:"",message:""}),$=(0,r.useRef)(null),[U,A]=(0,r.useState)({outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:""}),[F,H]=(0,r.useState)({type:"",message:""}),[J,_]=(0,r.useState)(!1),[D,M]=(0,r.useState)(!1);(0,r.useEffect)(()=>{g(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${m.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,m.QC)(t)}())},[f]),(0,r.useEffect)(()=>{let t=e?.settings||C;A({outboundProxyEnabled:t?.outboundProxyEnabled===!0,outboundProxyUrl:t?.outboundProxyUrl||"",outboundNoProxy:t?.outboundNoProxy||""}),T(!1)},[e]);let I=async e=>{if(e.preventDefault(),!0===C.outboundProxyEnabled){_(!0),H({type:"",message:""});try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyUrl:U.outboundProxyUrl,outboundNoProxy:U.outboundNoProxy})}),t=await e.json();e.ok?(S(e=>({...e,...t})),H({type:"success",message:"Proxy settings applied"})):H({type:"error",message:t.error||"Failed to update proxy settings"})}catch(e){H({type:"error",message:"An error occurred"})}finally{_(!1)}}},Z=async()=>{if(!0!==C.outboundProxyEnabled)return;let e=(U.outboundProxyUrl||"").trim();if(!e)return void H({type:"error",message:"Please enter a Proxy URL to test"});M(!0),H({type:"",message:""});try{let t=await fetch("/api/settings/proxy-test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyUrl:e})}),s=await t.json();t.ok&&s?.ok?H({type:"success",message:`Proxy test OK (${s.status}) in ${s.elapsedMs}ms`}):H({type:"error",message:s?.error||"Proxy test failed"})}catch(e){H({type:"error",message:"An error occurred"})}finally{M(!1)}},q=async e=>{_(!0),H({type:"",message:""});try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({outboundProxyEnabled:e})}),s=await t.json();t.ok?(S(e=>({...e,...s})),A(e=>({...e,outboundProxyEnabled:s?.outboundProxyEnabled===!0})),H({type:"success",message:e?"Proxy enabled":"Proxy disabled"})):H({type:"error",message:s.error||"Failed to update proxy settings"})}catch(e){H({type:"error",message:"An error occurred"})}finally{_(!1)}},z=async e=>{try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({fallbackStrategy:e})});if(t.ok)S(t=>({...t,fallbackStrategy:e}));else throw Error(`HTTP ${t.status}`)}catch(e){h("Failed to update settings")}},B=async e=>{try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategy:e})});if(t.ok)S(t=>({...t,comboStrategy:e}));else throw Error(`HTTP ${t.status}`)}catch(e){h("Failed to update combo strategy")}},Q=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({stickyRoundRobinLimit:t})});if(e.ok)S(e=>({...e,stickyRoundRobinLimit:t}));else throw Error(`HTTP ${e.status}`)}catch(e){h("Failed to update sticky limit")}},W=async e=>{let t=parseInt(e);if(!isNaN(t)&&!(t<1))try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStickyRoundRobinLimit:t})});if(e.ok)S(e=>({...e,comboStickyRoundRobinLimit:t}));else throw Error(`HTTP ${e.status}`)}catch(e){h("Failed to update combo sticky limit")}},K=async e=>{try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enableObservability:e})});if(t.ok)S(t=>({...t,enableObservability:e}));else throw Error(`HTTP ${t.status}`)}catch(e){h("Failed to update observability setting")}},G=async()=>{try{let e=await fetch("/api/settings");if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();S(t)}catch(e){h("Failed to reload settings")}},V=async()=>{O(!0),L({type:"",message:""});try{let e=await fetch("/api/settings/database");if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Failed to export database")}let t=await e.json(),s=JSON.stringify(t,null,2),a=new Blob([s],{type:"application/json"}),r=URL.createObjectURL(a),o=document.createElement("a"),i=new Date().toISOString().replace(/[.:]/g,"-");o.href=r,o.download=`switchboard-backup-${i}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r),L({type:"success",message:"Database backup downloaded"})}catch(e){L({type:"error",message:e.message||"Failed to export database"})}finally{O(!1)}},X=async e=>{let t=e.target.files?.[0];if($.current&&($.current.value=""),t){O(!0),L({type:"",message:""});try{let e=await t.text(),s=JSON.parse(e),a=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),r=await a.json().catch(()=>({}));if(!a.ok)throw Error(r.error||"Failed to import database");await G(),L({type:"success",message:"Database imported successfully"})}catch(e){L({type:"error",message:e.message||"Invalid backup file"})}finally{O(!1)}}},Y=!0===C.enableObservability,ee=async()=>{k(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(e){}k(!1),w(!1)};return(0,a.jsxs)("div",{className:"max-w-2xl mx-auto px-4 sm:px-0",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"size-10 sm:size-12 rounded-lg bg-green-500/10 text-green-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-xl sm:text-2xl",children:"computer"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg sm:text-xl font-semibold",children:"Local Mode"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Running on your machine"})]})]}),(0,a.jsx)("div",{className:"inline-flex p-1 rounded-lg bg-black/5 dark:bg-white/5 w-full sm:w-auto",children:["light","dark","system"].map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>s(e),className:(0,d.cn)("flex items-center justify-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1.5 rounded-md font-medium transition-all flex-1 sm:flex-initial",t===e?"bg-white dark:bg-white/10 text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"light"===e?"light_mode":"dark"===e?"dark_mode":"contrast"}),(0,a.jsx)("span",{className:"capitalize text-xs sm:text-sm",children:e})]},e))})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 pt-4 border-t border-border",children:[(0,a.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-3 rounded-lg bg-bg border border-border gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Database Location"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted font-mono break-all",children:"~/.switchboard/db/data.sqlite"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)(o.$n,{variant:"secondary",icon:"download",onClick:()=>V(),loading:R,className:"w-full sm:w-auto",children:"Download Backup"}),(0,a.jsx)(o.$n,{variant:"outline",icon:"upload",onClick:()=>$.current?.click(),disabled:R,className:"w-full sm:w-auto",children:"Import Backup"}),(0,a.jsx)("input",{ref:$,type:"file",accept:"application/json,.json",className:"hidden",onChange:X})]}),E.message&&(0,a.jsx)("p",{className:`text-sm ${"error"===E.type?"text-red-500":"text-green-600 dark:text-green-400"}`,children:E.message})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"size-10 rounded-lg bg-blue-500/10 text-blue-500 flex items-center justify-center shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Language"})]}),(0,a.jsxs)("button",{onClick:()=>j(!0),className:"flex items-center justify-between w-full p-3 rounded-lg bg-bg border border-border hover:border-primary/50 transition-colors","data-i18n-skip":"true",children:[(0,a.jsx)("span",{className:"text-sm text-text-muted",children:"Display language"}),(0,a.jsx)("span",{className:"text-2xl",children:x.h[y]||"\uD83C\uDF10"})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/10 text-blue-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"route"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Routing Strategy"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through accounts to distribute load"})]}),(0,a.jsx)(o.lM,{checked:"round-robin"===C.fallbackStrategy,onChange:()=>z("round-robin"===C.fallbackStrategy?"fill-first":"round-robin"),disabled:P})]}),"round-robin"===C.fallbackStrategy&&(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Sticky Limit"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Calls per account before switching"})]}),(0,a.jsx)(o.pd,{type:"number",min:"1",max:"10",value:C.stickyRoundRobinLimit||3,onChange:e=>Q(e.target.value),disabled:P,className:"w-16 sm:w-20 text-center shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4 pt-4 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Combo Round Robin"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Cycle through providers in combos instead of always starting with first"})]}),(0,a.jsx)(o.lM,{checked:"round-robin"===C.comboStrategy,onChange:()=>B("round-robin"===C.comboStrategy?"fallback":"round-robin"),disabled:P})]}),"round-robin"===C.comboStrategy&&(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Combo Sticky Limit"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Calls per combo model before switching"})]}),(0,a.jsx)(o.pd,{type:"number",min:"1",max:"100",value:C.comboStickyRoundRobinLimit||1,onChange:e=>W(e.target.value),disabled:P,className:"w-20 text-center"})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted italic pt-2 border-t border-border/50",children:["round-robin"===C.fallbackStrategy?`Currently distributing requests across all available accounts with ${C.stickyRoundRobinLimit||3} calls per account.`:"Currently using accounts in priority order (Fill First).","round-robin"===C.comboStrategy?` Combos rotate after ${C.comboStickyRoundRobinLimit||1} call${1===(C.comboStickyRoundRobinLimit||1)?"":"s"} per model.`:" Combos always start with their first model."]})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/10 text-purple-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"wifi"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Network"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Outbound Proxy"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Enable proxy for OAuth + provider outbound requests."})]}),(0,a.jsx)(o.lM,{checked:!0===C.outboundProxyEnabled,onChange:()=>q(!0!==C.outboundProxyEnabled),disabled:P||J})]}),!0===C.outboundProxyEnabled&&(0,a.jsxs)("form",{onSubmit:I,className:"flex flex-col gap-4 pt-2 border-t border-border/50",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"Proxy URL"}),(0,a.jsx)(o.pd,{placeholder:"http://127.0.0.1:7897",value:U.outboundProxyUrl,onChange:e=>A(t=>({...t,outboundProxyUrl:e.target.value})),disabled:P||J}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Leave empty to inherit existing env proxy (if any)."})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 pt-2 border-t border-border/50",children:[(0,a.jsx)("label",{className:"font-medium text-sm sm:text-base",children:"No Proxy"}),(0,a.jsx)(o.pd,{placeholder:"localhost,127.0.0.1",value:U.outboundNoProxy,onChange:e=>A(t=>({...t,outboundNoProxy:e.target.value})),disabled:P||J}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Comma-separated hostnames/domains to bypass the proxy."})]}),(0,a.jsxs)("div",{className:"pt-2 border-t border-border/50 flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[(0,a.jsx)(o.$n,{type:"button",variant:"secondary",loading:D,disabled:P||J,onClick:Z,className:"w-full sm:w-auto",children:"Test proxy URL"}),(0,a.jsx)(o.$n,{type:"submit",variant:"primary",loading:J,className:"w-full sm:w-auto",children:"Apply"})]})]}),F.message&&(0,a.jsx)("p",{className:`text-xs sm:text-sm ${"error"===F.type?"text-red-500":"text-green-500"} pt-2 border-t border-border/50`,children:F.message})]})]}),(0,a.jsxs)(o.Zp,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-orange-500/10 text-orange-500 shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"monitoring"})}),(0,a.jsx)("h3",{className:"text-base sm:text-lg font-semibold",children:"Observability"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm sm:text-base",children:"Enable Observability"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-text-muted",children:"Record request details for inspection in the logs view"})]}),(0,a.jsx)(o.lM,{checked:Y,onChange:K,disabled:P})]})]}),(0,a.jsx)("div",{className:"flex flex-col sm:flex-row gap-2",children:(0,a.jsx)(o.$n,{variant:"outline",fullWidth:!0,icon:"power_settings_new",onClick:()=>w(!0),className:"text-red-500 border-red-200 hover:bg-red-50 hover:border-red-300",children:"Shutdown"})}),(0,a.jsxs)("div",{className:"text-center text-xs sm:text-sm text-text-muted py-4",children:[(0,a.jsxs)("p",{children:[c.vQ.name," v",c.vQ.version]}),(0,a.jsx)("p",{className:"mt-1",children:"Local Mode - All data stored on your machine"})]})]}),(0,a.jsx)(l.default,{hideTrigger:!0,isOpen:f,onClose:e=>{j(!1),g(e)}}),(0,a.jsx)(i.ConfirmModal,{isOpen:N,onClose:()=>w(!1),onConfirm:ee,title:"Shutdown",message:"Are you sure you want to close the proxy server?",confirmText:"Shutdown",cancelText:"Cancel",variant:"danger",loading:v})]})}},34743:(e,t,s)=>{Promise.resolve().then(s.bind(s,12151))}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=34743)),_N_E=e.O()}]);