switchboard-router 0.9.8 → 0.9.10

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 (583) hide show
  1. package/app/.next/static/chunks/1321-a73f95036c368bd4.js +1 -0
  2. package/app/.next/static/chunks/1330-846d6a9e1497295e.js +7 -0
  3. package/app/.next/static/chunks/app/(dashboard)/dashboard/agent-library/page-65e302b698beee56.js +1 -0
  4. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-337881fe6c0cc77a.js +16 -0
  5. package/app/.next/static/chunks/app/(dashboard)/dashboard/loading-c80ac975cf0f4842.js +1 -0
  6. package/app/{.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-78d098f14f8cff05.js → .next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-efb20dd903e0dc94.js} +10 -10
  7. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-03290d1edb08623a.js +4 -0
  8. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-9bcd63bfeeac87c6.js +1 -0
  9. package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-97e0f7067cab0724.js → page-ca71683d9d850162.js} +3 -3
  10. package/app/.next/static/chunks/app/(dashboard)/dashboard/pxpipe/page-c5c37fbce431369b.js +1 -0
  11. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/page-b582299fa61407d9.js +1 -0
  12. package/app/.next/static/css/92ffae29025c5847.css +1 -0
  13. package/app/.next-cli-build/BUILD_ID +1 -1
  14. package/app/.next-cli-build/app-path-routes-manifest.json +8 -8
  15. package/app/.next-cli-build/build-manifest.json +2 -2
  16. package/app/.next-cli-build/prerender-manifest.json +3 -3
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +3 -3
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +10 -10
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +3 -3
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js +1 -1
  81. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
  82. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
  83. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  84. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  85. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  86. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  87. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  88. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  89. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  90. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  92. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  93. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  95. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  97. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  98. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  99. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  100. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  101. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  102. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  103. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  104. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  105. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  106. package/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  107. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  108. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  109. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  110. package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
  120. package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  122. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  124. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/claude-full-catalog/route.js +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/claude-full-catalog/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/claude-picker-labels/route.js +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/claude-picker-labels/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  133. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  137. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  139. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  140. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  141. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  142. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  143. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  145. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  146. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +2 -2
  147. package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
  149. package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
  151. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  153. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  155. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  157. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  159. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  161. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/cli-tools/picker-labels/route.js +1 -1
  163. package/app/.next-cli-build/server/app/api/cli-tools/picker-labels/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  165. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
  167. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/headroom/extras/route.js +1 -1
  169. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js +1 -1
  171. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/headroom/restart/route.js +1 -1
  173. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/headroom/start/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/headroom/status/route.js +1 -1
  177. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/headroom/stop/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/health/route.js +1 -1
  181. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  183. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  184. package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  185. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  198. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js +1 -1
  200. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js +1 -1
  202. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js +1 -1
  204. package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js +1 -1
  206. package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/mgmt/v1/metrics/route.js +2 -2
  208. package/app/.next-cli-build/server/app/api/mgmt/v1/metrics/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js +1 -1
  210. package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js +1 -1
  212. package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js +1 -1
  214. package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js +1 -1
  216. package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
  218. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
  220. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  222. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
  224. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  226. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  228. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  237. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
  239. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
  241. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  243. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  246. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js +1 -1
  248. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  252. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
  254. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  256. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  258. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
  260. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js +1 -1
  262. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js +1 -1
  264. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js +1 -1
  266. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js +1 -1
  268. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js +1 -1
  270. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js +1 -1
  272. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js +1 -1
  274. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js +1 -1
  276. package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  278. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  280. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  282. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  284. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  286. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  289. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  292. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  294. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +2 -2
  300. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +2 -2
  303. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  305. package/app/.next-cli-build/server/app/api/routing/feedback/route.js +1 -1
  306. package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
  307. package/app/.next-cli-build/server/app/api/routing/insights/route.js +1 -1
  308. package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
  309. package/app/.next-cli-build/server/app/api/routing/learn/route.js +1 -1
  310. package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
  311. package/app/.next-cli-build/server/app/api/routing/stats/route.js +1 -1
  312. package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
  313. package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js +1 -1
  314. package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
  315. package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js +1 -1
  316. package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
  317. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  318. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  321. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
  324. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  327. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  329. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  330. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  332. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  333. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  334. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  335. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  336. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  337. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  338. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  339. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  340. package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  341. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  342. package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  343. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  344. package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
  345. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  346. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  347. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  348. package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  349. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  350. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  351. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  352. package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  353. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  354. package/app/.next-cli-build/server/app/api/usage/stream/route.js +2 -6
  355. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  356. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  357. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  358. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  359. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  360. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  361. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  362. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  363. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  364. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  365. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  366. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  367. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  368. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  369. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js +1 -1
  370. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  371. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  372. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  373. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  374. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  375. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  376. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  377. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  378. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  379. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  380. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  381. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  382. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  383. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  384. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  385. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  386. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  387. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  388. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  389. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  390. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  391. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  392. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  393. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  394. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  395. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  396. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  397. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  398. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  399. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  400. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  401. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  402. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  403. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  404. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  405. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  406. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  407. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  408. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  409. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  410. package/app/.next-cli-build/server/app/callback.html +1 -1
  411. package/app/.next-cli-build/server/app/callback.rsc +4 -4
  412. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  413. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  414. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
  415. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  416. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  417. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  418. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  419. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  420. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  421. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  422. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
  423. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  424. package/app/.next-cli-build/server/app/index.html +1 -1
  425. package/app/.next-cli-build/server/app/index.rsc +4 -4
  426. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  427. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  428. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  429. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  430. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  431. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  432. package/app/.next-cli-build/server/app/landing.html +1 -1
  433. package/app/.next-cli-build/server/app/landing.rsc +4 -4
  434. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  435. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  436. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +4 -4
  437. package/app/.next-cli-build/server/app/login/page.js +1 -1
  438. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  439. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  440. package/app/.next-cli-build/server/app/login.html +1 -1
  441. package/app/.next-cli-build/server/app/login.rsc +4 -4
  442. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
  443. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  444. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  445. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  446. package/app/.next-cli-build/server/app/page.js +1 -1
  447. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  448. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  449. package/app/.next-cli-build/server/app-paths-manifest.json +8 -8
  450. package/app/.next-cli-build/server/chunks/1158.js +1 -0
  451. package/app/.next-cli-build/server/chunks/1274.js +1 -0
  452. package/app/.next-cli-build/server/chunks/1351.js +1 -0
  453. package/app/.next-cli-build/server/chunks/1792.js +2 -0
  454. package/app/.next-cli-build/server/chunks/{159.js → 1837.js} +1 -1
  455. package/app/.next-cli-build/server/chunks/1937.js +1 -1
  456. package/app/.next-cli-build/server/chunks/1998.js +1 -1
  457. package/app/.next-cli-build/server/chunks/{3986.js → 2142.js} +2 -2
  458. package/app/.next-cli-build/server/chunks/{9508.js → 27.js} +5 -42
  459. package/app/.next-cli-build/server/chunks/3423.js +1 -0
  460. package/app/.next-cli-build/server/chunks/3446.js +1 -1
  461. package/app/.next-cli-build/server/chunks/3593.js +1 -1
  462. package/app/.next-cli-build/server/chunks/369.js +10 -10
  463. package/app/.next-cli-build/server/chunks/3735.js +2 -2
  464. package/app/.next-cli-build/server/chunks/403.js +1 -0
  465. package/app/.next-cli-build/server/chunks/4330.js +7 -0
  466. package/app/.next-cli-build/server/chunks/{940.js → 4675.js} +2 -2
  467. package/app/.next-cli-build/server/chunks/4739.js +1 -1
  468. package/app/.next-cli-build/server/chunks/4780.js +1 -1
  469. package/app/.next-cli-build/server/chunks/4803.js +1 -1
  470. package/app/.next-cli-build/server/chunks/507.js +1 -1
  471. package/app/.next-cli-build/server/chunks/5115.js +1 -0
  472. package/app/.next-cli-build/server/chunks/519.js +1 -0
  473. package/app/.next-cli-build/server/chunks/5195.js +1 -0
  474. package/app/.next-cli-build/server/chunks/5258.js +1 -1
  475. package/app/.next-cli-build/server/chunks/5717.js +9 -14
  476. package/app/.next-cli-build/server/chunks/5774.js +1 -0
  477. package/app/.next-cli-build/server/chunks/5781.js +2 -2
  478. package/app/.next-cli-build/server/chunks/5888.js +1 -1
  479. package/app/.next-cli-build/server/chunks/5920.js +2 -2
  480. package/app/.next-cli-build/server/chunks/6194.js +1 -0
  481. package/app/.next-cli-build/server/chunks/6252.js +1 -1
  482. package/app/.next-cli-build/server/chunks/6305.js +2 -0
  483. package/app/.next-cli-build/server/chunks/6328.js +1 -1
  484. package/app/.next-cli-build/server/chunks/6406.js +1 -1
  485. package/app/.next-cli-build/server/chunks/6492.js +1 -1
  486. package/app/.next-cli-build/server/chunks/{5913.js → 6757.js} +38 -1
  487. package/app/.next-cli-build/server/chunks/698.js +1 -1
  488. package/app/.next-cli-build/server/chunks/7133.js +1 -0
  489. package/app/.next-cli-build/server/chunks/7454.js +1 -1
  490. package/app/.next-cli-build/server/chunks/{3072.js → 7880.js} +2 -2
  491. package/app/.next-cli-build/server/chunks/7965.js +1 -1
  492. package/app/.next-cli-build/server/chunks/8027.js +63 -0
  493. package/app/.next-cli-build/server/chunks/8062.js +1 -1
  494. package/app/.next-cli-build/server/chunks/8400.js +12 -12
  495. package/app/.next-cli-build/server/chunks/8469.js +1 -1
  496. package/app/.next-cli-build/server/chunks/8520.js +1 -1
  497. package/app/.next-cli-build/server/chunks/869.js +1 -1
  498. package/app/.next-cli-build/server/chunks/8775.js +1 -1
  499. package/app/.next-cli-build/server/chunks/8789.js +1 -1
  500. package/app/.next-cli-build/server/chunks/8942.js +2 -2
  501. package/app/.next-cli-build/server/chunks/8976.js +1 -1
  502. package/app/.next-cli-build/server/chunks/8998.js +33 -38
  503. package/app/.next-cli-build/server/chunks/9059.js +1 -0
  504. package/app/.next-cli-build/server/chunks/9091.js +3 -3
  505. package/app/.next-cli-build/server/chunks/9261.js +2 -2
  506. package/app/.next-cli-build/server/chunks/9264.js +2 -2
  507. package/app/.next-cli-build/server/chunks/9421.js +2 -2
  508. package/app/.next-cli-build/server/chunks/static/media/versions.4155c5ec.json +24 -0
  509. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  510. package/app/.next-cli-build/server/middleware.js +11 -16
  511. package/app/.next-cli-build/server/pages/404.html +1 -1
  512. package/app/.next-cli-build/server/pages/500.html +1 -1
  513. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  514. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  515. package/app/.next-cli-build/static/chunks/1321-a73f95036c368bd4.js +1 -0
  516. package/app/.next-cli-build/static/chunks/1330-846d6a9e1497295e.js +7 -0
  517. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/page-65e302b698beee56.js +1 -0
  518. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-337881fe6c0cc77a.js +16 -0
  519. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/loading-c80ac975cf0f4842.js +1 -0
  520. package/app/{.next/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-78d098f14f8cff05.js → .next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page-efb20dd903e0dc94.js} +10 -10
  521. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-03290d1edb08623a.js +4 -0
  522. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-9bcd63bfeeac87c6.js +1 -0
  523. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-97e0f7067cab0724.js → page-ca71683d9d850162.js} +3 -3
  524. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-c5c37fbce431369b.js +1 -0
  525. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-b582299fa61407d9.js +1 -0
  526. package/app/.next-cli-build/static/css/92ffae29025c5847.css +1 -0
  527. package/app/open-sse/identity/snapshots/versions.json +9 -5
  528. package/app/open-sse/identity/tls/bin/darwin/arm64/switchboard-claude-tls +0 -0
  529. package/app/open-sse/identity/tls/bin/darwin/x64/switchboard-claude-tls +0 -0
  530. package/app/open-sse/identity/tls/bin/linux/arm64/switchboard-claude-tls +0 -0
  531. package/app/open-sse/identity/tls/bin/linux/x64/switchboard-claude-tls +0 -0
  532. package/app/open-sse/identity/tls/bin/win32/arm64/switchboard-claude-tls.exe +0 -0
  533. package/app/open-sse/identity/tls/bin/win32/x64/switchboard-claude-tls.exe +0 -0
  534. package/app/package.json +1 -1
  535. package/app/public/i18n/literals/zh-CN.json +17 -1
  536. package/app/src/lib/updater/updater.js +7 -2
  537. package/cli.js +85 -33
  538. package/hooks/trayRuntime.js +72 -17
  539. package/package.json +1 -1
  540. package/src/cli/api/client.js +9 -3
  541. package/src/cli/cliOptions.js +1 -1
  542. package/src/cli/processManager.js +61 -1
  543. package/src/cli/serverStatus.js +66 -4
  544. package/src/cli/terminalUI.js +5 -2
  545. package/src/cli/tray/autostart.js +20 -4
  546. package/src/cli/tray/tray.js +4 -1
  547. package/src/cli/utils/display.js +20 -0
  548. package/app/.next/static/chunks/1321-0003ef56aef2b3ab.js +0 -1
  549. package/app/.next/static/chunks/1330-56405eca78b12fee.js +0 -7
  550. package/app/.next/static/chunks/app/(dashboard)/dashboard/agent-library/page-40f3ca16440f8e17.js +0 -1
  551. package/app/.next/static/chunks/app/(dashboard)/dashboard/endpoint/page-ca47b09e6ed6ae7b.js +0 -16
  552. package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-ff13a39fb7744f5e.js +0 -4
  553. package/app/.next/static/chunks/app/(dashboard)/dashboard/page-86cd6523dcd61f1b.js +0 -1
  554. package/app/.next/static/chunks/app/(dashboard)/dashboard/pxpipe/page-1805f993834a1adb.js +0 -1
  555. package/app/.next/static/chunks/app/(dashboard)/dashboard/skills/page-645e7c5ec034fe8c.js +0 -1
  556. package/app/.next/static/css/196a6347b9104610.css +0 -1
  557. package/app/.next-cli-build/server/chunks/1350.js +0 -1
  558. package/app/.next-cli-build/server/chunks/1656.js +0 -2
  559. package/app/.next-cli-build/server/chunks/194.js +0 -1
  560. package/app/.next-cli-build/server/chunks/3026.js +0 -1
  561. package/app/.next-cli-build/server/chunks/5616.js +0 -1
  562. package/app/.next-cli-build/server/chunks/6052.js +0 -2
  563. package/app/.next-cli-build/server/chunks/6182.js +0 -63
  564. package/app/.next-cli-build/server/chunks/6274.js +0 -1
  565. package/app/.next-cli-build/server/chunks/6347.js +0 -1
  566. package/app/.next-cli-build/server/chunks/849.js +0 -1
  567. package/app/.next-cli-build/server/chunks/8658.js +0 -1
  568. package/app/.next-cli-build/server/chunks/8834.js +0 -7
  569. package/app/.next-cli-build/server/chunks/9617.js +0 -1
  570. package/app/.next-cli-build/server/chunks/static/media/versions.401d57e8.json +0 -20
  571. package/app/.next-cli-build/static/chunks/1321-0003ef56aef2b3ab.js +0 -1
  572. package/app/.next-cli-build/static/chunks/1330-56405eca78b12fee.js +0 -7
  573. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/page-40f3ca16440f8e17.js +0 -1
  574. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-ca47b09e6ed6ae7b.js +0 -16
  575. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/page-ff13a39fb7744f5e.js +0 -4
  576. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/page-86cd6523dcd61f1b.js +0 -1
  577. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/pxpipe/page-1805f993834a1adb.js +0 -1
  578. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-645e7c5ec034fe8c.js +0 -1
  579. package/app/.next-cli-build/static/css/196a6347b9104610.css +0 -1
  580. /package/app/.next/static/{Kxe3gixpS84MCzX8yohZb → pVi5nGAVrNaYdEp0c24Nk}/_buildManifest.js +0 -0
  581. /package/app/.next/static/{Kxe3gixpS84MCzX8yohZb → pVi5nGAVrNaYdEp0c24Nk}/_ssgManifest.js +0 -0
  582. /package/app/.next-cli-build/static/{Kxe3gixpS84MCzX8yohZb → pVi5nGAVrNaYdEp0c24Nk}/_buildManifest.js +0 -0
  583. /package/app/.next-cli-build/static/{Kxe3gixpS84MCzX8yohZb → pVi5nGAVrNaYdEp0c24Nk}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";exports.id=6406,exports.ids=[6406],exports.modules={3771:(a,b,c)=>{c.d(b,{l:()=>j});var d=c(42461),e=c(19956),f=c(55511),g=c(90610),h=c(60290);function i(a){if(null==a)return"";if("string"==typeof a)return a;if(Array.isArray(a)){let b=[];for(let c of a)"string"==typeof c?b.push(c):c&&"object"==typeof c&&"string"==typeof c.text&&b.push(c.text);return b.join("\n")}return String(a)}function j(a,b,c){let{messages:d,system:e}=function(a=[]){let b=[],c=[];for(let d of a){if(!d)continue;let a=d.role;if(a===g.z7.SYSTEM){let a=i(d.content);a&&c.push(a);continue}if(a===g.z7.TOOL){let a="string"==typeof d.content?d.content:i(d.content);b.push({role:g.z7.TOOL,content:[{type:"tool-result",toolCallId:d.tool_call_id||"",toolName:d.name||"",output:{type:"text",value:a}}]});continue}if(a===g.z7.ASSISTANT){let a=[],c=i(d.content);if(d.reasoning_content&&a.push({type:"reasoning",text:d.reasoning_content}),c&&a.push({type:g.x4.TEXT,text:c}),Array.isArray(d.tool_calls))for(let b of d.tool_calls){let c=b.function||{};a.push({type:"tool-call",toolCallId:b.id||"",toolName:c.name||"",input:function(a){if(null==a)return{};if("string"!=typeof a)return a;try{return JSON.parse(a)}catch{return{raw:a}}}(c.arguments)})}b.push({role:g.z7.ASSISTANT,content:a.length?a:[{type:g.x4.TEXT,text:""}]});continue}b.push({role:g.z7.USER,content:function(a){if(null==a)return[{type:g.x4.TEXT,text:""}];if("string"==typeof a)return[{type:g.x4.TEXT,text:a}];if(Array.isArray(a)){let b=[];for(let c of a)"string"==typeof c?b.push({type:g.x4.TEXT,text:c}):c&&"object"==typeof c&&(c.type===g.x4.TEXT&&"string"==typeof c.text?b.push({type:g.x4.TEXT,text:c.text}):c.type===g.x4.IMAGE_URL||c.type===g.x4.IMAGE?c.image_url?.url?b.push({type:"image_url",image_url:{url:c.image_url.url}}):c.url?b.push({type:"image_url",image_url:{url:c.url}}):c.source?.data?b.push({type:"image",source:c.source}):b.push(c):"string"==typeof c.text&&b.push({type:g.x4.TEXT,text:c.text}));return b.length?b:[{type:g.x4.TEXT,text:""}]}return[{type:g.x4.TEXT,text:String(a)}]}(d.content)})}return{messages:b,system:c.join("\n\n")}}(b.messages),j={model:a,messages:d,stream:!1!==c,max_tokens:b.max_tokens??b.max_output_tokens??h.Uc,temperature:b.temperature??.3};e&&(j.system=e);let k=function(a){if(!Array.isArray(a)||0===a.length)return;let b=[];for(let c of a)c&&(c.type===g.x4.FUNCTION&&c.function?b.push({name:c.function.name,description:c.function.description,input_schema:c.function.parameters||{type:"object"}}):c.name&&(c.input_schema||c.parameters)&&b.push({name:c.name,description:c.description,input_schema:c.input_schema||c.parameters}));return b.length?b:void 0}(b.tools);k&&(j.tools=k),null!=b.top_p&&(j.top_p=b.top_p);let l=new Date().toISOString().slice(0,10);return{threadId:(0,f.randomUUID)(),memory:"",config:{workingDir:process.cwd(),date:l,environment:process.platform,structure:[],isGitRepo:!1,currentBranch:"",mainBranch:"",gitStatus:"",recentCommits:[]},params:j}}(0,d.kz)(e.h.OPENAI,e.h.COMMANDCODE,j,null)},19956:(a,b,c)=>{c.d(b,{h:()=>d,t:()=>e});let d={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",GEMINI_CLI:"gemini-cli",VERTEX:"vertex",CODEX:"codex",ANTIGRAVITY:"antigravity",KIRO:"kiro",CURSOR:"cursor",OLLAMA:"ollama",COMMANDCODE:"commandcode"};function e(a,b){return a.includes("/v1/responses")?d.OPENAI_RESPONSES:a.includes("/v1/messages")?d.CLAUDE:a.includes("/v1/chat/completions")&&Array.isArray(b?.input)?d.OPENAI:null}},42461:(a,b,c)=>{c.d(b,{E4:()=>h,KD:()=>g,kz:()=>f});let d=new Map,e=new Map;function f(a,b,c,f){let g=`${a}:${b}`;c&&d.set(g,c),f&&e.set(g,f)}function g(a,b){return d.get(`${a}:${b}`)}function h(a,b){return e.get(`${a}:${b}`)}},57642:(a,b,c)=>{c.d(b,{Ut:()=>e,a_:()=>f,bC:()=>d,lW:()=>g,zh:()=>h});let d={STOP:"stop",LENGTH:"length",TOOL_CALLS:"tool_calls",CONTENT_FILTER:"content_filter",ERROR:"error"},e={END_TURN:"end_turn",MAX_TOKENS:"max_tokens",TOOL_USE:"tool_use",STOP_SEQUENCE:"stop_sequence"},f={STOP:"STOP",MAX_TOKENS:"MAX_TOKENS",SAFETY:"SAFETY",RECITATION:"RECITATION",BLOCKLIST:"BLOCKLIST",PROHIBITED_CONTENT:"PROHIBITED_CONTENT",SPII:"SPII",IMAGE_SAFETY:"IMAGE_SAFETY",MALFORMED_FUNCTION_CALL:"MALFORMED_FUNCTION_CALL",UNEXPECTED_TOOL_CALL:"UNEXPECTED_TOOL_CALL",FINISH_REASON_UNSPECIFIED:"FINISH_REASON_UNSPECIFIED",OTHER:"OTHER",LANGUAGE:"LANGUAGE",NO_IMAGE:"NO_IMAGE"},g=new Set([f.MALFORMED_FUNCTION_CALL,f.UNEXPECTED_TOOL_CALL,f.FINISH_REASON_UNSPECIFIED,f.OTHER,f.LANGUAGE,f.NO_IMAGE]),h=new Set([f.SAFETY,f.RECITATION,f.BLOCKLIST,f.SPII,f.IMAGE_SAFETY,f.PROHIBITED_CONTENT])},83204:(a,b,c)=>{c.d(b,{P:()=>p,h:()=>q});var d=c(71553),e=c(77030);let f=new Set(["localhost","ip6-localhost","ip6-loopback","metadata.google.internal"]),g=[".internal",".local",".localhost"];function h(a){return String(a).toLowerCase().replace(/^\[|\]$/g,"").replace(/\.+$/,"")}function i(a){if(!a)return null;let b=new Set((Array.isArray(a)?a:[a]).map(h).filter(Boolean));return b.size?b:null}function j(a){let b=a.split(".");if(4!==b.length)return null;let c=0;for(let a of b){if(!/^\d{1,3}$/.test(a))return null;let b=Number(a);if(b>255)return null;c=256*c+b}return c>>>0}let k=[[j("0.0.0.0"),8],[j("10.0.0.0"),8],[j("127.0.0.0"),8],[j("169.254.0.0"),16],[j("172.16.0.0"),12],[j("192.168.0.0"),16],[j("100.64.0.0"),10]];function l(a){return k.some(([b,c])=>{let d=0===c?0:0xffffffff<<32-c>>>0;return(a&d)==(b&d)})}function m(a){let b=j(a);return null!==b&&l(b)}function n(a){let b=a.replace(/^\[|\]$/g,"").toLowerCase(),c=b.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/),d=c?.[1]||function(a){let b=a.split("::");if(b.length>2)return null;let c=b[0]?b[0].split(":").filter(Boolean):[],d=2===b.length&&b[1]?b[1].split(":").filter(Boolean):[],e=8-c.length-d.length;if(e<0||1===b.length&&0!==e)return null;let f=[...c,...Array(e).fill("0"),...d];if(8!==f.length||f.slice(0,5).some(a=>"0"!==a)||"ffff"!==f[5])return null;let g=Number.parseInt(f[6],16),h=Number.parseInt(f[7],16);return[g,h].every(a=>Number.isInteger(a)&&a>=0&&a<=65535)?`${g>>>8}.${255&g}.${h>>>8}.${255&h}`:null}(b);if(d)return m(d);let e=function(a){let b=a.split("::");if(b.length>2)return null;let c=b[0]?b[0].split(":").filter(Boolean):[],d=2===b.length&&b[1]?b[1].split(":").filter(Boolean):[],e=8-c.length-d.length;if(e<0||1===b.length&&0!==e)return null;let f=[...c,...Array(e).fill("0"),...d];if(8!==f.length)return null;let g=f.map(a=>parseInt(a,16));return g.some(a=>!Number.isInteger(a)||Number.isNaN(a)||a<0||a>65535)?null:g}(b);return e?!!(e.every(a=>0===a)||e.every((a,b)=>7===b?1===a:0===a))||(65472&e[0])==65152||(65024&e[0])==64512:b.startsWith("fe80:")||b.startsWith("fc")||b.startsWith("fd")}function o(a,b=null){let c=h(a);if(b?.has(c))return;if(f.has(c)||g.some(a=>c.endsWith(a)))throw Error("Blocked URL: internal host");let d=function(a){if(/^\d+$/.test(a)){let b=Number(a);if(Number.isSafeInteger(b)&&b>=0&&b<=0xffffffff)return b>>>0}if(/^0x[0-9a-f]+$/i.test(a)){let b=parseInt(a,16);if(Number.isFinite(b)&&b>=0&&b<=0xffffffff)return b>>>0}let b=a.split(".");if(4===b.length&&b.every(a=>/^(0x[0-9a-f]+|0[0-7]*|[1-9]\d*)$/i.test(a))){let a=0;for(let c of b){let b;if(!Number.isFinite(b=/^0x/i.test(c)?parseInt(c,16):c.startsWith("0")&&c.length>1?parseInt(c,8):parseInt(c,10))||b<0||b>255)return null;a=256*a+b}return a>>>0}let c=a.split(".");if((2===c.length||3===c.length)&&c.every(a=>/^\d{1,3}$/.test(a))){let a=c.map(Number),b=2**(8*(4-c.length))-1;if(a.slice(0,-1).every(a=>a<=255)&&a[c.length-1]<=b)return(2===c.length?0x1000000*a[0]+a[1]:0x1000000*a[0]+65536*a[1]+a[2])>>>0}return null}(c);if(null!==d&&l(d)||m(c)||c.includes(":")&&n(c)||4===(0,e.isIP)(c)&&m(c)||6===(0,e.isIP)(c)&&n(c))throw Error("Blocked URL: private IP")}function p(a,b=null){let c;try{c=new URL(a)}catch{throw Error("Blocked URL: invalid URL")}if("http:"!==c.protocol&&"https:"!==c.protocol)throw Error("Blocked URL: unsupported scheme");o(c.hostname,i(b))}async function q(a,b=null){let c,f=i(b);p(a,b);let g=h(new URL(a).hostname);if(!f?.has(g)&&!(0,e.isIP)(g)){try{c=await (0,d.lookup)(g,{all:!0,verbatim:!0})}catch{throw Error("Blocked URL: DNS resolution failed")}if(!c?.length)throw Error("Blocked URL: DNS resolution failed");for(let a of c)o(a.address,f)}}},90610:(a,b,c)=>{c.d(b,{R4:()=>g,BY:()=>l,a_:()=>j.a_,RV:()=>e,rP:()=>k,x4:()=>f,bC:()=>j.bC,Du:()=>h,z7:()=>d,m8:()=>i});let d={USER:"user",ASSISTANT:"assistant",TOOL:"tool",SYSTEM:"system",DEVELOPER:"developer"},e={USER:"user",MODEL:"model"},f={TEXT:"text",IMAGE_URL:"image_url",IMAGE:"image",INPUT_AUDIO:"input_audio",AUDIO_URL:"audio_url",FILE:"file",FUNCTION:"function"},g={TEXT:"text",IMAGE:"image",DOCUMENT:"document",TOOL_USE:"tool_use",TOOL_RESULT:"tool_result",THINKING:"thinking",REDACTED_THINKING:"redacted_thinking"},h={MESSAGE:"message",FUNCTION_CALL:"function_call",FUNCTION_CALL_OUTPUT:"function_call_output",REASONING:"reasoning",OUTPUT_TEXT:"output_text",INPUT_TEXT:"input_text",INPUT_IMAGE:"input_image",INPUT_FILE:"input_file",SUMMARY_TEXT:"summary_text"},i=[f.TEXT,f.IMAGE_URL,f.IMAGE,f.INPUT_AUDIO,f.AUDIO_URL,f.FILE];f.TEXT,f.IMAGE_URL,f.IMAGE,g.TOOL_RESULT;var j=c(57642);let k="unknown",l="image/png"}};
1
+ "use strict";exports.id=6406,exports.ids=[6406],exports.modules={3771:(a,b,c)=>{c.d(b,{l:()=>j});var d=c(42461),e=c(19956),f=c(55511),g=c(90610),h=c(60290);function i(a){if(null==a)return"";if("string"==typeof a)return a;if(Array.isArray(a)){let b=[];for(let c of a)"string"==typeof c?b.push(c):c&&"object"==typeof c&&"string"==typeof c.text&&b.push(c.text);return b.join("\n")}return String(a)}function j(a,b,c){let{messages:d,system:e}=function(a=[]){let b=[],c=[];for(let d of a){if(!d)continue;let a=d.role;if(a===g.z7.SYSTEM){let a=i(d.content);a&&c.push(a);continue}if(a===g.z7.TOOL){let a="string"==typeof d.content?d.content:i(d.content);b.push({role:g.z7.TOOL,content:[{type:"tool-result",toolCallId:d.tool_call_id||"",toolName:d.name||"",output:{type:"text",value:a}}]});continue}if(a===g.z7.ASSISTANT){let a=[],c=i(d.content);if(d.reasoning_content&&a.push({type:"reasoning",text:d.reasoning_content}),c&&a.push({type:g.x4.TEXT,text:c}),Array.isArray(d.tool_calls))for(let b of d.tool_calls){let c=b.function||{};a.push({type:"tool-call",toolCallId:b.id||"",toolName:c.name||"",input:function(a){if(null==a)return{};if("string"!=typeof a)return a;try{return JSON.parse(a)}catch{return{raw:a}}}(c.arguments)})}b.push({role:g.z7.ASSISTANT,content:a.length?a:[{type:g.x4.TEXT,text:""}]});continue}b.push({role:g.z7.USER,content:function(a){if(null==a)return[{type:g.x4.TEXT,text:""}];if("string"==typeof a)return[{type:g.x4.TEXT,text:a}];if(Array.isArray(a)){let b=[];for(let c of a)"string"==typeof c?b.push({type:g.x4.TEXT,text:c}):c&&"object"==typeof c&&(c.type===g.x4.TEXT&&"string"==typeof c.text?b.push({type:g.x4.TEXT,text:c.text}):c.type===g.x4.IMAGE_URL||c.type===g.x4.IMAGE?c.image_url?.url?b.push({type:"image_url",image_url:{url:c.image_url.url}}):c.url?b.push({type:"image_url",image_url:{url:c.url}}):c.source?.data?b.push({type:"image",source:c.source}):b.push(c):"string"==typeof c.text&&b.push({type:g.x4.TEXT,text:c.text}));return b.length?b:[{type:g.x4.TEXT,text:""}]}return[{type:g.x4.TEXT,text:String(a)}]}(d.content)})}return{messages:b,system:c.join("\n\n")}}(b.messages),j={model:a,messages:d,stream:!1!==c,max_tokens:b.max_tokens??b.max_output_tokens??h.Uc,temperature:b.temperature??.3};e&&(j.system=e);let k=function(a){if(!Array.isArray(a)||0===a.length)return;let b=[];for(let c of a)c&&(c.type===g.x4.FUNCTION&&c.function?b.push({name:c.function.name,description:c.function.description,input_schema:c.function.parameters||{type:"object"}}):c.name&&(c.input_schema||c.parameters)&&b.push({name:c.name,description:c.description,input_schema:c.input_schema||c.parameters}));return b.length?b:void 0}(b.tools);k&&(j.tools=k),null!=b.top_p&&(j.top_p=b.top_p);let l=new Date().toISOString().slice(0,10);return{threadId:(0,f.randomUUID)(),memory:"",config:{workingDir:process.cwd(),date:l,environment:process.platform,structure:[],isGitRepo:!1,currentBranch:"",mainBranch:"",gitStatus:"",recentCommits:[]},params:j}}(0,d.kz)(e.h.OPENAI,e.h.COMMANDCODE,j,null)},42461:(a,b,c)=>{c.d(b,{E4:()=>h,KD:()=>g,kz:()=>f});let d=new Map,e=new Map;function f(a,b,c,f){let g=`${a}:${b}`;c&&d.set(g,c),f&&e.set(g,f)}function g(a,b){return d.get(`${a}:${b}`)}function h(a,b){return e.get(`${a}:${b}`)}},57642:(a,b,c)=>{c.d(b,{Ut:()=>e,a_:()=>f,bC:()=>d,lW:()=>g,zh:()=>h});let d={STOP:"stop",LENGTH:"length",TOOL_CALLS:"tool_calls",CONTENT_FILTER:"content_filter",ERROR:"error"},e={END_TURN:"end_turn",MAX_TOKENS:"max_tokens",TOOL_USE:"tool_use",STOP_SEQUENCE:"stop_sequence"},f={STOP:"STOP",MAX_TOKENS:"MAX_TOKENS",SAFETY:"SAFETY",RECITATION:"RECITATION",BLOCKLIST:"BLOCKLIST",PROHIBITED_CONTENT:"PROHIBITED_CONTENT",SPII:"SPII",IMAGE_SAFETY:"IMAGE_SAFETY",MALFORMED_FUNCTION_CALL:"MALFORMED_FUNCTION_CALL",UNEXPECTED_TOOL_CALL:"UNEXPECTED_TOOL_CALL",FINISH_REASON_UNSPECIFIED:"FINISH_REASON_UNSPECIFIED",OTHER:"OTHER",LANGUAGE:"LANGUAGE",NO_IMAGE:"NO_IMAGE"},g=new Set([f.MALFORMED_FUNCTION_CALL,f.UNEXPECTED_TOOL_CALL,f.FINISH_REASON_UNSPECIFIED,f.OTHER,f.LANGUAGE,f.NO_IMAGE]),h=new Set([f.SAFETY,f.RECITATION,f.BLOCKLIST,f.SPII,f.IMAGE_SAFETY,f.PROHIBITED_CONTENT])},83204:(a,b,c)=>{c.d(b,{P:()=>p,h:()=>q});var d=c(71553),e=c(77030);let f=new Set(["localhost","ip6-localhost","ip6-loopback","metadata.google.internal"]),g=[".internal",".local",".localhost"];function h(a){return String(a).toLowerCase().replace(/^\[|\]$/g,"").replace(/\.+$/,"")}function i(a){if(!a)return null;let b=new Set((Array.isArray(a)?a:[a]).map(h).filter(Boolean));return b.size?b:null}function j(a){let b=a.split(".");if(4!==b.length)return null;let c=0;for(let a of b){if(!/^\d{1,3}$/.test(a))return null;let b=Number(a);if(b>255)return null;c=256*c+b}return c>>>0}let k=[[j("0.0.0.0"),8],[j("10.0.0.0"),8],[j("127.0.0.0"),8],[j("169.254.0.0"),16],[j("172.16.0.0"),12],[j("192.168.0.0"),16],[j("100.64.0.0"),10]];function l(a){return k.some(([b,c])=>{let d=0===c?0:0xffffffff<<32-c>>>0;return(a&d)==(b&d)})}function m(a){let b=j(a);return null!==b&&l(b)}function n(a){let b=a.replace(/^\[|\]$/g,"").toLowerCase(),c=b.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/),d=c?.[1]||function(a){let b=a.split("::");if(b.length>2)return null;let c=b[0]?b[0].split(":").filter(Boolean):[],d=2===b.length&&b[1]?b[1].split(":").filter(Boolean):[],e=8-c.length-d.length;if(e<0||1===b.length&&0!==e)return null;let f=[...c,...Array(e).fill("0"),...d];if(8!==f.length||f.slice(0,5).some(a=>"0"!==a)||"ffff"!==f[5])return null;let g=Number.parseInt(f[6],16),h=Number.parseInt(f[7],16);return[g,h].every(a=>Number.isInteger(a)&&a>=0&&a<=65535)?`${g>>>8}.${255&g}.${h>>>8}.${255&h}`:null}(b);if(d)return m(d);let e=function(a){let b=a.split("::");if(b.length>2)return null;let c=b[0]?b[0].split(":").filter(Boolean):[],d=2===b.length&&b[1]?b[1].split(":").filter(Boolean):[],e=8-c.length-d.length;if(e<0||1===b.length&&0!==e)return null;let f=[...c,...Array(e).fill("0"),...d];if(8!==f.length)return null;let g=f.map(a=>parseInt(a,16));return g.some(a=>!Number.isInteger(a)||Number.isNaN(a)||a<0||a>65535)?null:g}(b);return e?!!(e.every(a=>0===a)||e.every((a,b)=>7===b?1===a:0===a))||(65472&e[0])==65152||(65024&e[0])==64512:b.startsWith("fe80:")||b.startsWith("fc")||b.startsWith("fd")}function o(a,b=null){let c=h(a);if(b?.has(c))return;if(f.has(c)||g.some(a=>c.endsWith(a)))throw Error("Blocked URL: internal host");let d=function(a){if(/^\d+$/.test(a)){let b=Number(a);if(Number.isSafeInteger(b)&&b>=0&&b<=0xffffffff)return b>>>0}if(/^0x[0-9a-f]+$/i.test(a)){let b=parseInt(a,16);if(Number.isFinite(b)&&b>=0&&b<=0xffffffff)return b>>>0}let b=a.split(".");if(4===b.length&&b.every(a=>/^(0x[0-9a-f]+|0[0-7]*|[1-9]\d*)$/i.test(a))){let a=0;for(let c of b){let b;if(!Number.isFinite(b=/^0x/i.test(c)?parseInt(c,16):c.startsWith("0")&&c.length>1?parseInt(c,8):parseInt(c,10))||b<0||b>255)return null;a=256*a+b}return a>>>0}let c=a.split(".");if((2===c.length||3===c.length)&&c.every(a=>/^\d{1,3}$/.test(a))){let a=c.map(Number),b=2**(8*(4-c.length))-1;if(a.slice(0,-1).every(a=>a<=255)&&a[c.length-1]<=b)return(2===c.length?0x1000000*a[0]+a[1]:0x1000000*a[0]+65536*a[1]+a[2])>>>0}return null}(c);if(null!==d&&l(d)||m(c)||c.includes(":")&&n(c)||4===(0,e.isIP)(c)&&m(c)||6===(0,e.isIP)(c)&&n(c))throw Error("Blocked URL: private IP")}function p(a,b=null){let c;try{c=new URL(a)}catch{throw Error("Blocked URL: invalid URL")}if("http:"!==c.protocol&&"https:"!==c.protocol)throw Error("Blocked URL: unsupported scheme");o(c.hostname,i(b))}async function q(a,b=null){let c,f=i(b);p(a,b);let g=h(new URL(a).hostname);if(!f?.has(g)&&!(0,e.isIP)(g)){try{c=await (0,d.lookup)(g,{all:!0,verbatim:!0})}catch{throw Error("Blocked URL: DNS resolution failed")}if(!c?.length)throw Error("Blocked URL: DNS resolution failed");for(let a of c)o(a.address,f)}}},90610:(a,b,c)=>{c.d(b,{R4:()=>g,BY:()=>l,a_:()=>j.a_,RV:()=>e,rP:()=>k,x4:()=>f,bC:()=>j.bC,Du:()=>h,z7:()=>d,m8:()=>i});let d={USER:"user",ASSISTANT:"assistant",TOOL:"tool",SYSTEM:"system",DEVELOPER:"developer"},e={USER:"user",MODEL:"model"},f={TEXT:"text",IMAGE_URL:"image_url",IMAGE:"image",INPUT_AUDIO:"input_audio",AUDIO_URL:"audio_url",FILE:"file",FUNCTION:"function"},g={TEXT:"text",IMAGE:"image",DOCUMENT:"document",TOOL_USE:"tool_use",TOOL_RESULT:"tool_result",THINKING:"thinking",REDACTED_THINKING:"redacted_thinking"},h={MESSAGE:"message",FUNCTION_CALL:"function_call",FUNCTION_CALL_OUTPUT:"function_call_output",REASONING:"reasoning",OUTPUT_TEXT:"output_text",INPUT_TEXT:"input_text",INPUT_IMAGE:"input_image",INPUT_FILE:"input_file",SUMMARY_TEXT:"summary_text"},i=[f.TEXT,f.IMAGE_URL,f.IMAGE,f.INPUT_AUDIO,f.AUDIO_URL,f.FILE];f.TEXT,f.IMAGE_URL,f.IMAGE,g.TOOL_RESULT;var j=c(57642);let k="unknown",l="image/png"}};
@@ -1 +1 @@
1
- "use strict";exports.id=6492,exports.ids=[6492],exports.modules={46492:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{backfillCodexEmails:()=>x,exchangeTokens:()=>u,extractCodexAccountInfo:()=>l.YR,fetchKiroProfileArn:()=>l.gR,generateAuthData:()=>t,getProvider:()=>r,getProviderNames:()=>s,pollForToken:()=>w,requestDeviceCode:()=>v});var e=c(77168),f=c(55511),g=c.n(f),h=c(10793),i=c(25467),j=c(13073),k=c(25482),l=c(1100),m=c(54383),n=c(50969),o=c(79791),p=a([e]);e=(p.then?(await p)():p)[0];let y=null;async function q(){if(y)return y;try{let a=await (0,n.Fm)(k.o.discoveryUrl,{headers:{Accept:"application/json"},identity:"grok-cli",provider:"xai",format:"openai"});if(a.ok){let b=await a.json();return y={authorizeUrl:(0,l.js)(b.authorization_endpoint,"authorization_endpoint"),tokenUrl:(0,l.js)(b.token_endpoint,"token_endpoint")}}}catch{}return y={authorizeUrl:k.o.authorizeUrl,tokenUrl:k.o.tokenUrl}}let z={claude:{config:j.OV,flowType:"authorization_code_pkce",buildAuthUrl:(a,b,c,d)=>{let e=new URLSearchParams({code:"true",client_id:a.clientId,response_type:"code",redirect_uri:b,scope:a.scopes.join(" "),code_challenge:d,code_challenge_method:a.codeChallengeMethod,state:c});return`${a.authorizeUrl}?${e.toString()}`},exchangeToken:async(a,b,c,d,e)=>{let f=b,g="";if(f.includes("#")){let a=f.split("#");f=a[0],g=a[1]||""}let h=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({code:f,state:g||e,grant_type:"authorization_code",client_id:a.clientId,redirect_uri:c,code_verifier:d}),...(0,l.ro)("claude")});if(!h.ok){let a=await h.text();throw Error(`Token exchange failed: ${a}`)}return await h.json()},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope})},codex:{config:j.DI,flowType:"authorization_code_pkce",fixedPort:j.DI.fixedPort,callbackPath:j.DI.callbackPath,buildAuthUrl:(a,b,c,d)=>{let e={response_type:"code",client_id:a.clientId,redirect_uri:b,scope:a.scope,code_challenge:d,code_challenge_method:a.codeChallengeMethod,...a.extraParams,state:c},f=Object.entries(e).map(([a,b])=>`${a}=${encodeURIComponent(b)}`).join("&");return`${a.authorizeUrl}?${f}`},exchangeToken:async(a,b,c,d)=>{let e=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,code:b,redirect_uri:c,code_verifier:d}),...(0,l.ro)("codex")});if(!e.ok){let a=await e.text();throw Error(`Token exchange failed: ${a}`)}return await e.json()},mapTokens:a=>{let b=(0,l.YR)(a.id_token),c={accessToken:a.access_token,refreshToken:a.refresh_token,idToken:a.id_token,expiresIn:a.expires_in,lastRefreshAt:new Date().toISOString()},d=b.email||(0,l.J_)(a.access_token);return d&&(c.email=d),(b.chatgptAccountId||b.chatgptPlanType)&&(c.providerSpecificData={chatgptAccountId:b.chatgptAccountId,chatgptPlanType:b.chatgptPlanType}),c}},xai:{config:k.o,flowType:"authorization_code_pkce",fixedPort:k.o.loopbackPort,callbackPath:k.o.callbackPath,pkceVerifierBytes:k.U,prepareConfig:async a=>{let b=await q();return{...a,authorizeUrl:b.authorizeUrl,tokenUrl:b.tokenUrl}},buildAuthUrl:(a,b,c,d)=>{let e=g().randomBytes(16).toString("hex"),f={response_type:"code",client_id:a.clientId,redirect_uri:b,scope:a.scope,code_challenge:d,code_challenge_method:a.codeChallengeMethod,state:c,nonce:e,plan:"generic",referrer:"cli-proxy-api"},h=Object.entries(f).map(([a,b])=>`${a}=${encodeURIComponent(b)}`).join("&");return`${a.authorizeUrl}?${h}`},exchangeToken:async(a,b,c,d)=>{let e=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,code:b,redirect_uri:c,code_verifier:d}),identity:"grok-cli",provider:"xai",format:"openai"});if(!e.ok){let a=await e.text();throw Error(`xAI token exchange failed: ${a}`)}return await e.json()},mapTokens:a=>{let b={accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope},c=(0,l.pG)(a.id_token);return c&&(b.email=c),a.id_token&&(b.providerSpecificData={idToken:a.id_token}),b}},"grok-cli":{config:j.qp,flowType:"device_code",requestDeviceCode:o.Sx,pollToken:(a,b)=>(0,o.A9)(a,b),postExchange:o.R8,mapTokens:o.mn},"gemini-cli":{config:j.LT,flowType:"authorization_code",buildAuthUrl:(a,b,c)=>{let d=new URLSearchParams({client_id:a.clientId,response_type:"code",redirect_uri:b,scope:a.scopes.join(" "),state:c,access_type:"offline",prompt:"consent"});return`${a.authorizeUrl}?${d.toString()}`},exchangeToken:async(a,b,c)=>{let d=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,client_secret:a.clientSecret,code:b,redirect_uri:c}),...(0,l.ro)("gemini-cli")});if(!d.ok){let a=await d.text();throw Error(`Token exchange failed: ${a}`)}return await d.json()},postExchange:async a=>{let b=await (0,n.Fm)(`${j.LT.userInfoUrl}?alt=json`,{headers:{Authorization:`Bearer ${a.access_token}`},...(0,l.ro)("gemini-cli")}),c=b.ok?await b.json():{},d="";try{let b=await (0,n.Fm)("https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",{method:"POST",headers:{Authorization:`Bearer ${a.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({metadata:(0,j.cD)(),mode:1}),...(0,l.ro)("gemini-cli")});if(b.ok){let a=await b.json();d=a.cloudaicompanionProject?.id||a.cloudaicompanionProject||""}}catch(a){console.log("Failed to fetch project ID:",a)}return{userInfo:c,projectId:d}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope,email:b?.userInfo?.email,projectId:b?.projectId})},antigravity:{config:j.YT,flowType:"authorization_code",buildAuthUrl:(a,b,c)=>{let d=new URLSearchParams({client_id:a.clientId,response_type:"code",redirect_uri:b,scope:a.scopes.join(" "),state:c,access_type:"offline",prompt:"consent"});return`${a.authorizeUrl}?${d.toString()}`},exchangeToken:async(a,b,c)=>{let d=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,client_secret:a.clientSecret,code:b,redirect_uri:c}),identity:"antigravity",provider:"antigravity",format:"antigravity"});if(!d.ok){let a=await d.text();throw Error(`Token exchange failed: ${a}`)}return await d.json()},postExchange:async a=>{let b={Authorization:`Bearer ${a.access_token}`,"Content-Type":"application/json","X-Goog-Api-Client":j.YT.loadCodeAssistApiClient,"Client-Metadata":j.YT.loadCodeAssistClientMetadata},c=(0,j.cD)(),d=await (0,n.Fm)(`${j.YT.userInfoUrl}?alt=json`,{headers:{Authorization:`Bearer ${a.access_token}`},identity:"antigravity",provider:"antigravity",format:"antigravity"}),e=d.ok?await d.json():{},f="",g="legacy-tier";try{let a=await (0,n.Fm)(j.YT.loadCodeAssistEndpoint,{method:"POST",headers:b,body:JSON.stringify({metadata:c}),identity:"antigravity",provider:"antigravity",format:"antigravity"});if(a.ok){let b=await a.json();if(f=b.cloudaicompanionProject?.id||b.cloudaicompanionProject||"",Array.isArray(b.allowedTiers)){for(let a of b.allowedTiers)if(a.isDefault&&a.id){g=a.id.trim();break}}}}catch(a){console.log("Failed to load code assist:",a)}return f&&(async()=>{for(let a=0;a<10;a++){try{let a=await (0,n.Fm)(j.YT.onboardUserEndpoint,{method:"POST",headers:b,body:JSON.stringify({tierId:g,metadata:c}),identity:"antigravity",provider:"antigravity",format:"antigravity"});if(a.ok){let b=await a.json();if(!0===b.done)break}}catch(a){break}await new Promise(a=>setTimeout(a,5e3))}})().catch(()=>{}),{userInfo:e,projectId:f}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope,email:b?.userInfo?.email,projectId:b?.projectId})},iflow:{config:j.ZL,flowType:"authorization_code",buildAuthUrl:(a,b,c)=>{let d=new URLSearchParams({loginMethod:a.extraParams.loginMethod,type:a.extraParams.type,redirect:b,state:c,client_id:a.clientId});return`${a.authorizeUrl}?${d.toString()}`},exchangeToken:async(a,b,c)=>{let d=Buffer.from(`${a.clientId}:${a.clientSecret}`).toString("base64"),e=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${d}`},body:new URLSearchParams({grant_type:"authorization_code",code:b,redirect_uri:c,client_id:a.clientId,client_secret:a.clientSecret}),...(0,l.ro)("iflow")});if(!e.ok){let a=await e.text();throw Error(`Token exchange failed: ${a}`)}return await e.json()},postExchange:async a=>{let b=await (0,n.Fm)(`${j.ZL.userInfoUrl}?accessToken=${encodeURIComponent(a.access_token)}`,{headers:{Accept:"application/json"},...(0,l.ro)("iflow")});if(!b.ok){let a=await b.text();throw Error(`Failed to fetch user info: ${a}`)}let c=await b.json();if(!c.success)throw Error(`User info request failed: ${c.message||"Unknown error"}`);let d=c.data||{};if(!d.apiKey||""===d.apiKey.trim())throw Error("Empty API key returned from iFlow");if(!(d.email?.trim()||d.phone?.trim()))throw Error("Missing account email/phone in user info");return{userInfo:d}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,apiKey:b?.userInfo?.apiKey,email:b?.userInfo?.email||b?.userInfo?.phone,displayName:b?.userInfo?.nickname||b?.userInfo?.name})},qoder:{config:j.hF,flowType:"device_code",requestDeviceCode:async a=>{let{QoderService:b}=await c.e(8117).then(c.bind(c,18117)),d=new b().initiateDeviceFlow();return{device_code:d.nonce,user_code:d.nonce.slice(0,8).toUpperCase(),verification_uri:a.loginUrl,verification_uri_complete:d.verificationUriComplete,expires_in:300,interval:2,codeVerifier:d.codeVerifier,_qoderNonce:d.nonce,_qoderMachineId:d.machineId}},pollToken:async(a,b,d,e)=>{let f,{QoderService:g}=await c.e(8117).then(c.bind(c,18117)),h=new g,i=b||e?._qoderNonce,j=d||e?._qoderVerifier;if(!i||!j)return{ok:!1,data:{error:"invalid_request",error_description:"Missing nonce/verifier"}};try{f=await h.pollDeviceToken({nonce:i,codeVerifier:j})}catch(a){return{ok:!1,data:{error:"poll_failed",error_description:a.message}}}if("pending"===f.status)return{ok:!1,data:{error:"authorization_pending"}};let k=await h.fetchUserInfo(f.accessToken),l=Math.floor((f.expireTime-Date.now())/1e3),m=Math.max(86400,l);return{ok:!0,data:{access_token:f.accessToken,refresh_token:f.refreshToken,expires_in:m,_qoderUserId:f.userId,_qoderMachineId:e?._qoderMachineId||"",_qoderName:k.name,_qoderEmail:k.email,_qoderOrganizationId:k.organizationId}}},mapTokens:a=>{let b=(a._qoderEmail||"").trim(),c=(a._qoderName||"").trim()||null,d=a._qoderUserId||"",e=b||(d?`qoder-user-${d}`:null);return{accessToken:a.access_token,refreshToken:a.refresh_token||null,expiresIn:a.expires_in,email:e,displayName:c,providerSpecificData:{authMethod:"device",userId:d,machineId:a._qoderMachineId||"",organizationId:a._qoderOrganizationId||""}}}},qwen:{config:j.Hp,flowType:"device_code",requestDeviceCode:async(a,b)=>{let c=await (0,n.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:a.clientId,scope:a.scope,code_challenge:b,code_challenge_method:a.codeChallengeMethod}),...(0,l.ro)("qwen")});if(!c.ok){let a=await c.text();throw Error(`Device code request failed: ${a}`)}return await c.json()},pollToken:async(a,b,c)=>{let d=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:a.clientId,device_code:b,code_verifier:c}),...(0,l.ro)("qwen")});return{ok:d.ok,data:await d.json()}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,providerSpecificData:{resourceUrl:a.resource_url}})},github:{config:j.Nu,flowType:"device_code",requestDeviceCode:async a=>{let b=await (0,n.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:a.clientId,scope:a.scopes}),...(0,l.ro)("github")});if(!b.ok){let a=await b.text();throw Error(`Device code request failed: ${a}`)}return await b.json()},pollToken:async(a,b)=>{let c,d=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:a.clientId,device_code:b,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),...(0,l.ro)("github")});try{c=await d.json()}catch(b){let a=await d.text();c={error:"invalid_response",error_description:a}}return{ok:d.ok,data:c}},postExchange:async a=>{let b=await (0,n.Fm)(j.Nu.copilotTokenUrl,{headers:{Authorization:`Bearer ${a.access_token}`,Accept:"application/json"},identity:"copilot",provider:"github",format:"openai"}),c=b.ok?await b.json():{},d=await (0,n.Fm)(j.Nu.userInfoUrl,{headers:{Authorization:`Bearer ${a.access_token}`,Accept:"application/json","X-GitHub-Api-Version":j.Nu.apiVersion},identity:"copilot",provider:"github",format:"openai"}),e=d.ok?await d.json():{};return{copilotToken:c,userInfo:e}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,providerSpecificData:{copilotToken:b?.copilotToken?.token,copilotTokenExpiresAt:b?.copilotToken?.expires_at,githubUserId:b?.userInfo?.id,githubLogin:b?.userInfo?.login,githubName:b?.userInfo?.name,githubEmail:b?.userInfo?.email}})},kiro:{config:j.Tx,flowType:"device_code",requestDeviceCode:async(a,b,c={})=>{let d=("string"==typeof c.region?c.region.trim():"")||"us-east-1";(0,j.S6)(d);let e=("string"==typeof c.startUrl?c.startUrl.trim():"")||a.startUrl,f="idc"===c.authMethod?"idc":"builder-id",g=`https://oidc.${d}.amazonaws.com/client/register`,h=`https://oidc.${d}.amazonaws.com/device_authorization`,i=await (0,n.Fm)(g,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientName:a.clientName,clientType:a.clientType,scopes:a.scopes,grantTypes:a.grantTypes,issuerUrl:a.issuerUrl}),...(0,l.ro)("kiro")});if(!i.ok){let a=await i.text();throw Error(`Client registration failed: ${a}`)}let k=await i.json(),m=await (0,n.Fm)(h,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:k.clientId,clientSecret:k.clientSecret,startUrl:e}),...(0,l.ro)("kiro")});if(!m.ok){let a=await m.text();throw Error(`Device authorization failed: ${a}`)}let o=await m.json();return{device_code:o.deviceCode,user_code:o.userCode,verification_uri:o.verificationUri,verification_uri_complete:o.verificationUriComplete,expires_in:o.expiresIn,interval:o.interval||5,_clientId:k.clientId,_clientSecret:k.clientSecret,_region:d,_authMethod:f,_startUrl:e}},pollToken:async(a,b,c,d)=>{let e,f=d?._region||"us-east-1";(0,j.S6)(f);let g=(0,m.R)(d?._profileArn);if(d?._profileArn&&!g)throw Error("A valid Kiro profile ARN is required for IAM Identity Center");let h=`https://oidc.${f}.amazonaws.com/token`,i=await (0,n.Fm)(h,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:d?._clientId,clientSecret:d?._clientSecret,deviceCode:b,grantType:"urn:ietf:params:oauth:grant-type:device_code"}),...(0,l.ro)("kiro")});try{e=await i.json()}catch(b){let a=await i.text();e={error:"invalid_response",error_description:a}}if(e.accessToken){let a=(0,m.R)(e.profileArn),b=a?.profileArn||g?.profileArn||await (0,l.gR)(e.accessToken,f);if(d?._authMethod==="idc"&&!b)throw Error("Kiro did not return an enterprise profile. Check that the subscription is active, or enter a profile ARN from `kiro-cli whoami`.");return{ok:!0,data:{access_token:e.accessToken,refresh_token:e.refreshToken,expires_in:e.expiresIn,profile_arn:b,_clientId:d?._clientId,_clientSecret:d?._clientSecret,_region:d?._region,_authMethod:d?._authMethod,_startUrl:d?._startUrl}}}return{ok:!1,data:{error:e.error||"authorization_pending",error_description:e.error_description||e.message}}},mapTokens:a=>{let b=(0,l.J_)(a.access_token);return{accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,email:b,providerSpecificData:{profileArn:a?.profile_arn||null,clientId:a._clientId,clientSecret:a._clientSecret,region:a._region||"us-east-1",authMethod:a._authMethod||"builder-id",startUrl:a._startUrl||j.Tx.startUrl}}}},cursor:{config:j.WN,flowType:"import_token",mapTokens:a=>({accessToken:a.accessToken,refreshToken:null,expiresIn:a.expiresIn||86400,providerSpecificData:{machineId:a.machineId,authMethod:"imported"}})},"kimi-coding":{config:j.t,flowType:"device_code",requestDeviceCode:async a=>{let b=g().randomUUID(),c=await (0,n.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...(0,h.VK)(b)},body:new URLSearchParams({client_id:a.clientId}),...(0,l.ro)("kimi-coding")});if(!c.ok){let a=await c.text();throw Error(`Device code request failed: ${a}`)}let d=await c.json();return{device_code:d.device_code,user_code:d.user_code,verification_uri:d.verification_uri||"https://www.kimi.com/code/authorize_device",verification_uri_complete:d.verification_uri_complete||`https://www.kimi.com/code/authorize_device?user_code=${d.user_code}`,expires_in:d.expires_in,interval:d.interval||5,_kimiDeviceId:b}},pollToken:async(a,b,c,d)=>{let e,f=d?._kimiDeviceId,g=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...(0,h.VK)(f)},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:a.clientId,device_code:b}),...(0,l.ro)("kimi-coding")});try{e=await g.json()}catch(b){let a=await g.text();e={error:"invalid_response",error_description:a}}return e.access_token&&f&&(e._kimiDeviceId=f),{ok:g.ok,data:e}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,...a._kimiDeviceId?{providerSpecificData:{deviceId:a._kimiDeviceId}}:{}})},kilocode:{config:j.MZ,flowType:"device_code",requestDeviceCode:async a=>{let b=await (0,n.Fm)(a.initiateUrl,{method:"POST",headers:{"Content-Type":"application/json"},...(0,l.ro)("kilocode")});if(!b.ok){if(429===b.status)throw Error("Too many pending authorization requests. Please try again later.");let a=await b.text();throw Error(`Device auth initiation failed: ${a}`)}let c=await b.json();return{device_code:c.code,user_code:c.code,verification_uri:c.verificationUrl,verification_uri_complete:c.verificationUrl,expires_in:c.expiresIn||300,interval:3}},pollToken:async(a,b)=>{let c=await (0,n.Fm)(`${a.pollUrlBase}/${b}`,{...(0,l.ro)("kilocode")});if(202===c.status)return{ok:!1,data:{error:"authorization_pending"}};if(403===c.status)return{ok:!1,data:{error:"access_denied",error_description:"Authorization denied by user"}};if(410===c.status)return{ok:!1,data:{error:"expired_token",error_description:"Authorization code expired"}};if(!c.ok)return{ok:!1,data:{error:"poll_failed",error_description:`Poll failed: ${c.status}`}};let d=await c.json();if("approved"===d.status&&d.token){let b=null;try{let c=await (0,n.Fm)(`${a.apiBaseUrl}/api/profile`,{headers:{Authorization:`Bearer ${d.token}`},...(0,l.ro)("kilocode")});if(c.ok){let a=await c.json();b=a.organizations?.[0]?.id||null}}catch{}return{ok:!0,data:{access_token:d.token,_userEmail:d.userEmail,_orgId:b}}}return{ok:!1,data:{error:"authorization_pending"}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:null,expiresIn:null,email:a._userEmail,...a._orgId?{providerSpecificData:{orgId:a._orgId}}:{}})},cline:{config:j.lB,flowType:"authorization_code",buildAuthUrl:(a,b)=>{let c=new URLSearchParams({client_type:"extension",callback_url:b,redirect_uri:b});return`${a.authorizeUrl}?${c.toString()}`},exchangeToken:async(a,b,c)=>{try{let a=b,c=4-a.length%4;4!==c&&(a+="=".repeat(c));let d=Buffer.from(a,"base64").toString("utf-8"),e=d.lastIndexOf("}");if(-1===e)throw Error("No JSON found in decoded code");let f=JSON.parse(d.substring(0,e+1));return{access_token:f.accessToken,refresh_token:f.refreshToken,email:f.email,firstName:f.firstName,lastName:f.lastName,expires_at:f.expiresAt}}catch(f){let d=await (0,n.Fm)(a.tokenExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:b,client_type:"extension",redirect_uri:c}),...(0,l.ro)("cline")});if(!d.ok){let a=await d.text();throw Error(`Cline token exchange failed: ${a}`)}let e=await d.json();return{access_token:e.data?.accessToken||e.accessToken,refresh_token:e.data?.refreshToken||e.refreshToken,email:e.data?.userInfo?.email||"",expires_at:e.data?.expiresAt||e.expiresAt}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_at?Math.floor((new Date(a.expires_at).getTime()-Date.now())/1e3):3600,email:a.email,providerSpecificData:{firstName:a.firstName,lastName:a.lastName}})},clinepass:{config:j.w1,flowType:"authorization_code",buildAuthUrl:(a,b)=>{let c=new URLSearchParams({client_type:"extension",callback_url:b,redirect_uri:b});return`${a.authorizeUrl}?${c.toString()}`},exchangeToken:async(a,b,c)=>{try{let a=b,c=4-a.length%4;4!==c&&(a+="=".repeat(c));let d=Buffer.from(a,"base64").toString("utf-8"),e=d.lastIndexOf("}");if(-1===e)throw Error("No JSON found in decoded code");let f=JSON.parse(d.substring(0,e+1));return{access_token:f.accessToken,refresh_token:f.refreshToken,email:f.email,firstName:f.firstName,lastName:f.lastName,expires_at:f.expiresAt}}catch(f){let d=await (0,n.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:b,client_type:"extension",redirect_uri:c}),...(0,l.ro)("clinepass")});if(!d.ok){let a=await d.text();throw Error(`ClinePass token exchange failed: ${a}`)}let e=await d.json();return{access_token:e.data?.accessToken||e.accessToken,refresh_token:e.data?.refreshToken||e.refreshToken,email:e.data?.userInfo?.email||"",expires_at:e.data?.expiresAt||e.expiresAt}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_at?Math.floor((new Date(a.expires_at).getTime()-Date.now())/1e3):3600,email:a.email,providerSpecificData:{firstName:a.firstName,lastName:a.lastName}})},gitlab:{config:j.f7,flowType:"authorization_code_pkce",buildAuthUrl:(a,b,c,d,e={})=>{let f=e.baseUrl||a.defaultBaseUrl,g=e.clientId||"",h=new URLSearchParams({client_id:g,redirect_uri:b,response_type:"code",state:c,scope:a.scope,code_challenge:d,code_challenge_method:a.codeChallengeMethod});return`${f}${a.authorizeUrlPath}?${h.toString()}`},exchangeToken:async(a,b,c,d,e,f={})=>{let g=f.baseUrl||a.defaultBaseUrl,h=f.clientId||"",i=f.clientSecret||"",j=new URLSearchParams({client_id:h,grant_type:"authorization_code",code:b,redirect_uri:c,code_verifier:d});i&&j.set("client_secret",i);let k=await (0,n.Fm)(`${g}${a.tokenUrlPath}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:j.toString(),...(0,l.ro)("gitlab")});if(!k.ok)throw Error(`GitLab token exchange failed: ${await k.text()}`);let m=await k.json(),o=await (0,n.Fm)(`${g}${a.userInfoUrlPath}`,{headers:{Authorization:`Bearer ${m.access_token}`},...(0,l.ro)("gitlab")}),p=o.ok?await o.json():{};return{...m,_user:p,_baseUrl:g,_clientId:h}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope,providerSpecificData:{username:a._user?.username||"",email:a._user?.email||a._user?.public_email||"",name:a._user?.name||"",baseUrl:a._baseUrl,clientId:a._clientId,authKind:"oauth"}})},"codebuddy-cn":{config:j.Nl,flowType:"device_code",requestDeviceCode:async a=>{let b=await (0,n.Fm)(`${a.stateUrl}?platform=${a.platform}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":a.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":"copilot.tencent.com","X-No-Authorization":"true","X-No-User-Id":"true","X-Product":"SaaS"},body:"{}",...(0,l.ro)("codebuddy-cn")});if(!b.ok)throw Error(`CodeBuddy state request failed: ${await b.text()}`);let c=await b.json();if(0!==c.code||!c.data?.state||!c.data?.authUrl)throw Error(`CodeBuddy state error: ${c.msg||"missing state/authUrl"}`);return{device_code:c.data.state,verification_uri:c.data.authUrl,user_code:"",interval:a.pollInterval/1e3,_isCodeBuddy:!0}},pollToken:async(a,b)=>{let c=await (0,n.Fm)(`${a.tokenUrl}?state=${encodeURIComponent(b)}`,{method:"GET",headers:{Accept:"application/json","User-Agent":a.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":"copilot.tencent.com","X-No-Authorization":"true","X-No-User-Id":"true","X-No-Enterprise-Id":"true","X-No-Department-Info":"true","X-Product":"SaaS"},...(0,l.ro)("codebuddy-cn")});if(!c.ok)return{ok:!1,data:{error:"request_failed"}};let d=await c.json();return 0===d.code&&d.data?.accessToken?{ok:!0,data:{access_token:d.data.accessToken,refresh_token:d.data.refreshToken||"",token_type:d.data.tokenType||"Bearer",expires_in:d.data.expiresIn}}:11217===d.code?{ok:!0,data:{error:"authorization_pending"}}:{ok:!1,data:{error:d.msg||"unknown_error"}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in||86400,providerSpecificData:{}})},kimchi:{config:j.Td,flowType:"browser_token",buildAuthUrl:(a,b,c)=>{let d=(a.webAppUrl||"https://app.kimchi.dev").replace(/\/+$/,""),e=new URLSearchParams({callback:b,state:c});return`${d}/cli-auth?${e.toString()}`},exchangeToken:async(a,b)=>{let c=String(b||"").trim();if(!c)throw Error("Missing Kimchi token");let d=a.validationUrl||"https://api.cast.ai/v1/llm/openai/supported-providers",e=await (0,n.Fm)(d,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${c}`},...(0,l.ro)("kimchi")});if(!e.ok)throw Error(`Kimchi token validation failed: ${e.status}`);let f={};if(a.userInfoUrl)try{let b=await (0,n.Fm)(a.userInfoUrl,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${c}`},...(0,l.ro)("kimchi")});b.ok&&(f=await b.json())}catch{f={}}return{access_token:c,token_type:"Bearer",_kimchiUser:f}},mapTokens:a=>{let b=a._kimchiUser||{},c=b.id?String(b.id):"",d=b.username||"",e=b.email||(c?`kimchi-user-${c}`:null);return{accessToken:a.access_token,refreshToken:null,email:e,displayName:b.name||d||null,providerSpecificData:{authMethod:"browser_token",userId:c,username:d}}}}};function r(a){let b=z[a];if(!b)throw Error(`Unknown provider: ${a}`);return b}function s(){return Object.keys(z)}async function t(a,b,c){let d=r(a),e=d.prepareConfig?await d.prepareConfig(d.config,c||{}):d.config,{codeVerifier:f,codeChallenge:g,state:h}=(0,i.lz)(d.pkceVerifierBytes);return{authUrl:"device_code"===d.flowType?null:"authorization_code_pkce"===d.flowType?d.buildAuthUrl(e,b,h,g,c||{}):d.buildAuthUrl(e,b,h,void 0,c||{}),state:h,codeVerifier:f,codeChallenge:g,redirectUri:b,flowType:d.flowType,fixedPort:d.fixedPort,callbackPath:d.callbackPath||"/callback"}}async function u(a,b,c,d,e,f){let g=r(a),h=g.prepareConfig?await g.prepareConfig(g.config,f||{}):g.config,i=await g.exchangeToken(h,b,c,d,e,f||{}),j=null;return g.postExchange&&(j=await g.postExchange(i)),g.mapTokens(i,j)}async function v(a,b,c){let d=r(a);if("device_code"!==d.flowType)throw Error(`Provider ${a} does not support device code flow`);return await d.requestDeviceCode(d.config,b,c||{})}async function w(a,b,c,d){let e=r(a);if("device_code"!==e.flowType)throw Error(`Provider ${a} does not support device code flow`);let f=await e.pollToken(e.config,b,c,d);if(f.ok)if(f.data.access_token){let b=null;e.postExchange&&(b=await e.postExchange(f.data));let c=e.mapTokens(f.data,b);if("kiro"===a&&!c.providerSpecificData?.profileArn){let a=await (0,l.gR)(c.accessToken,c.providerSpecificData?.region);a&&(c.providerSpecificData.profileArn=a)}return{success:!0,tokens:c}}else if("authorization_pending"===f.data.error||"slow_down"===f.data.error)return{success:!1,error:f.data.error,errorDescription:f.data.error_description||f.data.message,pending:"authorization_pending"===f.data.error};else return{success:!1,error:f.data.error||"no_access_token",errorDescription:f.data.error_description||f.data.message||"No access token received"};return{success:!1,error:f.data.error,errorDescription:f.data.error_description}}let A=!1;async function x(){if(!A){A=!0;try{let{getProviderConnections:a,updateProviderConnection:b}=await Promise.resolve().then(c.bind(c,77326));for(let c of(await a()).filter(a=>{if("codex"!==a.provider||"oauth"!==a.authType||!a.idToken)return!1;let b=!!a.email,c=!!a.providerSpecificData?.chatgptAccountId;return!b||!c})){let a=(0,l.YR)(c.idToken);if(!a.email&&!a.chatgptAccountId)continue;let d={};!c.email&&a.email&&(d.email=a.email),(a.chatgptAccountId||a.chatgptPlanType)&&(d.providerSpecificData={...c.providerSpecificData||{},chatgptAccountId:a.chatgptAccountId,chatgptPlanType:a.chatgptPlanType}),Object.keys(d).length&&await b(c.id,d)}}catch(a){A=!1,console.log("backfillCodexEmails failed:",a?.message||a)}}}d()}catch(a){d(a)}})},79791:(a,b,c)=>{c.d(b,{A9:()=>i,R8:()=>j,Sx:()=>h,mn:()=>k});var d=c(50969),e=c(83382),f=c(1100);async function g(a){let b=await a.text();try{return JSON.parse(b)}catch{return{error:"invalid_response",error_description:b}}}async function h(a){let b=new URLSearchParams({client_id:a.clientId,scope:a.scope});a.referrer&&b.set("referrer",a.referrer);let c=await (0,d.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:b,...e.Ai}),f=await g(c);if(!c.ok)throw Error(`Grok CLI device code request failed: ${f.error_description||f.error||c.status}`);return f}async function i(a,b){let c=await (0,d.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:b,client_id:a.clientId}),...e.Ai}),f=await g(c),h="authorization_pending"===f.error||"slow_down"===f.error;return{ok:c.ok||h,data:f}}async function j(a){try{let b=await (0,d.Fm)(`${e.Nr}/user`,{headers:(0,e.Ab)(a.access_token),...e.Ai});return{user:b.ok?await b.json():null}}catch{return{user:null}}}function k(a,b=null){let c=b?.user||{},d=(0,f.pG)(a.id_token)||(0,f.J_)(a.access_token)||c.email,e=c.userId||c.principalId||null,g=[c.firstName,c.lastName].filter(Boolean).join(" ").trim();return{accessToken:a.access_token,refreshToken:a.refresh_token||null,expiresIn:a.expires_in,scope:a.scope,...d?{email:d}:{},...g?{displayName:g}:{},providerSpecificData:{authMethod:"device_code",idToken:a.id_token||null,email:d||null,userId:e,hasGrokCodeAccess:c.hasGrokCodeAccess??null,subscriptionTier:c.subscriptionTier??null}}}}};
1
+ "use strict";exports.id=6492,exports.ids=[6492],exports.modules={46492:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{backfillCodexEmails:()=>y,exchangeTokens:()=>v,extractCodexAccountInfo:()=>l.YR,fetchKiroProfileArn:()=>l.gR,generateAuthData:()=>u,getProvider:()=>s,getProviderNames:()=>t,pollForToken:()=>x,requestDeviceCode:()=>w});var e=c(77168),f=c(55511),g=c.n(f),h=c(10793),i=c(25467),j=c(13073),k=c(25482),l=c(1100),m=c(54383),n=c(59581),o=c(50969),p=c(79791),q=a([e]);e=(q.then?(await q)():q)[0];let z=null;async function r(){if(z)return z;try{let a=await (0,o.Fm)(k.o.discoveryUrl,{headers:{Accept:"application/json"},identity:"grok-cli",provider:"xai",format:"openai"});if(a.ok){let b=await a.json();return z={authorizeUrl:(0,l.js)(b.authorization_endpoint,"authorization_endpoint"),tokenUrl:(0,l.js)(b.token_endpoint,"token_endpoint")}}}catch{}return z={authorizeUrl:k.o.authorizeUrl,tokenUrl:k.o.tokenUrl}}let A={claude:{config:j.OV,flowType:"authorization_code_pkce",buildAuthUrl:(a,b,c,d)=>{let e=new URLSearchParams({code:"true",client_id:a.clientId,response_type:"code",redirect_uri:b,scope:a.scopes.join(" "),code_challenge:d,code_challenge_method:a.codeChallengeMethod,state:c});return`${a.authorizeUrl}?${e.toString()}`},exchangeToken:async(a,b,c,d,e)=>{let f=b,g="";if(f.includes("#")){let a=f.split("#");f=a[0],g=a[1]||""}let h=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({code:f,state:g||e,grant_type:"authorization_code",client_id:a.clientId,redirect_uri:c,code_verifier:d}),...(0,l.ro)("claude")});if(!h.ok){let a=await h.text();throw Error(`Token exchange failed: ${a}`)}return await h.json()},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope})},codex:{config:j.DI,flowType:"authorization_code_pkce",fixedPort:j.DI.fixedPort,callbackPath:j.DI.callbackPath,buildAuthUrl:(a,b,c,d)=>{let e={response_type:"code",client_id:a.clientId,redirect_uri:b,scope:a.scope,code_challenge:d,code_challenge_method:a.codeChallengeMethod,...a.extraParams,state:c},f=Object.entries(e).map(([a,b])=>`${a}=${encodeURIComponent(b)}`).join("&");return`${a.authorizeUrl}?${f}`},exchangeToken:async(a,b,c,d)=>{let e=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,code:b,redirect_uri:c,code_verifier:d}),...(0,l.ro)("codex")});if(!e.ok){let a=await e.text();throw Error(`Token exchange failed: ${a}`)}return await e.json()},mapTokens:a=>{let b=(0,l.YR)(a.id_token),c={accessToken:a.access_token,refreshToken:a.refresh_token,idToken:a.id_token,expiresIn:a.expires_in,lastRefreshAt:new Date().toISOString()},d=b.email||(0,l.J_)(a.access_token);return d&&(c.email=d),(b.chatgptAccountId||b.chatgptPlanType)&&(c.providerSpecificData={chatgptAccountId:b.chatgptAccountId,chatgptPlanType:b.chatgptPlanType}),c}},xai:{config:k.o,flowType:"authorization_code_pkce",fixedPort:k.o.loopbackPort,callbackPath:k.o.callbackPath,pkceVerifierBytes:k.U,prepareConfig:async a=>{let b=await r();return{...a,authorizeUrl:b.authorizeUrl,tokenUrl:b.tokenUrl}},buildAuthUrl:(a,b,c,d)=>{let e=g().randomBytes(16).toString("hex"),f={response_type:"code",client_id:a.clientId,redirect_uri:b,scope:a.scope,code_challenge:d,code_challenge_method:a.codeChallengeMethod,state:c,nonce:e,plan:"generic",referrer:"cli-proxy-api"},h=Object.entries(f).map(([a,b])=>`${a}=${encodeURIComponent(b)}`).join("&");return`${a.authorizeUrl}?${h}`},exchangeToken:async(a,b,c,d)=>{let e=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,code:b,redirect_uri:c,code_verifier:d}),identity:"grok-cli",provider:"xai",format:"openai"});if(!e.ok){let a=await e.text();throw Error(`xAI token exchange failed: ${a}`)}return await e.json()},mapTokens:a=>{let b={accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope},c=(0,l.pG)(a.id_token);return c&&(b.email=c),a.id_token&&(b.providerSpecificData={idToken:a.id_token}),b}},"grok-cli":{config:j.qp,flowType:"device_code",requestDeviceCode:p.Sx,pollToken:(a,b)=>(0,p.A9)(a,b),postExchange:p.R8,mapTokens:p.mn},"gemini-cli":{config:j.LT,flowType:"authorization_code",buildAuthUrl:(a,b,c)=>{let d=new URLSearchParams({client_id:a.clientId,response_type:"code",redirect_uri:b,scope:a.scopes.join(" "),state:c,access_type:"offline",prompt:"consent"});return`${a.authorizeUrl}?${d.toString()}`},exchangeToken:async(a,b,c)=>{let d=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,client_secret:a.clientSecret,code:b,redirect_uri:c}),...(0,l.ro)("gemini-cli")});if(!d.ok){let a=await d.text();throw Error(`Token exchange failed: ${a}`)}return await d.json()},postExchange:async a=>{let b=await (0,o.Fm)(`${j.LT.userInfoUrl}?alt=json`,{headers:{Authorization:`Bearer ${a.access_token}`},...(0,l.ro)("gemini-cli")}),c=b.ok?await b.json():{},d="";try{let b=await (0,o.Fm)("https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",{method:"POST",headers:{Authorization:`Bearer ${a.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({metadata:(0,j.cD)(),mode:1}),...(0,l.ro)("gemini-cli")});if(b.ok){let a=await b.json();d=a.cloudaicompanionProject?.id||a.cloudaicompanionProject||""}}catch(a){console.log("Failed to fetch project ID:",a)}return{userInfo:c,projectId:d}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope,email:b?.userInfo?.email,projectId:b?.projectId})},antigravity:{config:j.YT,flowType:"authorization_code",buildAuthUrl:(a,b,c)=>{let d=new URLSearchParams({client_id:a.clientId,response_type:"code",redirect_uri:b,scope:a.scopes.join(" "),state:c,access_type:"offline",prompt:"consent"});return`${a.authorizeUrl}?${d.toString()}`},exchangeToken:async(a,b,c)=>{let d=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"authorization_code",client_id:a.clientId,client_secret:a.clientSecret,code:b,redirect_uri:c}),identity:"antigravity",provider:"antigravity",format:"antigravity"});if(!d.ok){let a=await d.text();throw Error(`Token exchange failed: ${a}`)}return await d.json()},postExchange:async a=>{let b={Authorization:`Bearer ${a.access_token}`,"Content-Type":"application/json","X-Goog-Api-Client":j.YT.loadCodeAssistApiClient,"Client-Metadata":j.YT.loadCodeAssistClientMetadata},c=(0,j.cD)(),d=await (0,o.Fm)(`${j.YT.userInfoUrl}?alt=json`,{headers:{Authorization:`Bearer ${a.access_token}`},identity:"antigravity",provider:"antigravity",format:"antigravity"}),e=d.ok?await d.json():{},f="",g="legacy-tier";try{let a=await (0,o.Fm)(j.YT.loadCodeAssistEndpoint,{method:"POST",headers:b,body:JSON.stringify({metadata:c}),identity:"antigravity",provider:"antigravity",format:"antigravity"});if(a.ok){let b=await a.json();if(f=b.cloudaicompanionProject?.id||b.cloudaicompanionProject||"",Array.isArray(b.allowedTiers)){for(let a of b.allowedTiers)if(a.isDefault&&a.id){g=a.id.trim();break}}}}catch(a){console.log("Failed to load code assist:",a)}return f&&(async()=>{for(let a=0;a<10;a++){try{let a=await (0,o.Fm)(j.YT.onboardUserEndpoint,{method:"POST",headers:b,body:JSON.stringify({tierId:g,metadata:c}),identity:"antigravity",provider:"antigravity",format:"antigravity"});if(a.ok){let b=await a.json();if(!0===b.done)break}}catch(a){break}await new Promise(a=>setTimeout(a,5e3))}})().catch(()=>{}),{userInfo:e,projectId:f}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope,email:b?.userInfo?.email,projectId:b?.projectId})},iflow:{config:j.ZL,flowType:"authorization_code",buildAuthUrl:(a,b,c)=>{let d=new URLSearchParams({loginMethod:a.extraParams.loginMethod,type:a.extraParams.type,redirect:b,state:c,client_id:a.clientId});return`${a.authorizeUrl}?${d.toString()}`},exchangeToken:async(a,b,c)=>{let d=Buffer.from(`${a.clientId}:${a.clientSecret}`).toString("base64"),e=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${d}`},body:new URLSearchParams({grant_type:"authorization_code",code:b,redirect_uri:c,client_id:a.clientId,client_secret:a.clientSecret}),...(0,l.ro)("iflow")});if(!e.ok){let a=await e.text();throw Error(`Token exchange failed: ${a}`)}return await e.json()},postExchange:async a=>{let b=await (0,o.Fm)(`${j.ZL.userInfoUrl}?accessToken=${encodeURIComponent(a.access_token)}`,{headers:{Accept:"application/json"},...(0,l.ro)("iflow")});if(!b.ok){let a=await b.text();throw Error(`Failed to fetch user info: ${a}`)}let c=await b.json();if(!c.success)throw Error(`User info request failed: ${c.message||"Unknown error"}`);let d=c.data||{};if(!d.apiKey||""===d.apiKey.trim())throw Error("Empty API key returned from iFlow");if(!(d.email?.trim()||d.phone?.trim()))throw Error("Missing account email/phone in user info");return{userInfo:d}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,apiKey:b?.userInfo?.apiKey,email:b?.userInfo?.email||b?.userInfo?.phone,displayName:b?.userInfo?.nickname||b?.userInfo?.name})},qoder:{config:j.hF,flowType:"device_code",requestDeviceCode:async a=>{let{QoderService:b}=await c.e(8117).then(c.bind(c,18117)),d=new b().initiateDeviceFlow();return{device_code:d.nonce,user_code:d.nonce.slice(0,8).toUpperCase(),verification_uri:a.loginUrl,verification_uri_complete:d.verificationUriComplete,expires_in:300,interval:2,codeVerifier:d.codeVerifier,_qoderNonce:d.nonce,_qoderMachineId:d.machineId}},pollToken:async(a,b,d,e)=>{let f,{QoderService:g}=await c.e(8117).then(c.bind(c,18117)),h=new g,i=b||e?._qoderNonce,j=d||e?._qoderVerifier;if(!i||!j)return{ok:!1,data:{error:"invalid_request",error_description:"Missing nonce/verifier"}};try{f=await h.pollDeviceToken({nonce:i,codeVerifier:j})}catch(a){return{ok:!1,data:{error:"poll_failed",error_description:a.message}}}if("pending"===f.status)return{ok:!1,data:{error:"authorization_pending"}};let k=await h.fetchUserInfo(f.accessToken),l=Math.floor((f.expireTime-Date.now())/1e3),m=Math.max(86400,l);return{ok:!0,data:{access_token:f.accessToken,refresh_token:f.refreshToken,expires_in:m,_qoderUserId:f.userId,_qoderMachineId:e?._qoderMachineId||"",_qoderName:k.name,_qoderEmail:k.email,_qoderOrganizationId:k.organizationId}}},mapTokens:a=>{let b=(a._qoderEmail||"").trim(),c=(a._qoderName||"").trim()||null,d=a._qoderUserId||"",e=b||(d?`qoder-user-${d}`:null);return{accessToken:a.access_token,refreshToken:a.refresh_token||null,expiresIn:a.expires_in,email:e,displayName:c,providerSpecificData:{authMethod:"device",userId:d,machineId:a._qoderMachineId||"",organizationId:a._qoderOrganizationId||""}}}},qwen:{config:j.Hp,flowType:"device_code",requestDeviceCode:async(a,b)=>{let c=await (0,o.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:a.clientId,scope:a.scope,code_challenge:b,code_challenge_method:a.codeChallengeMethod}),...(0,l.ro)("qwen")});if(!c.ok){let a=await c.text();throw Error(`Device code request failed: ${a}`)}return await c.json()},pollToken:async(a,b,c)=>{let d=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:a.clientId,device_code:b,code_verifier:c}),...(0,l.ro)("qwen")});return{ok:d.ok,data:await d.json()}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,providerSpecificData:{resourceUrl:a.resource_url}})},github:{config:j.Nu,flowType:"device_code",requestDeviceCode:async a=>{let b=await (0,o.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:a.clientId,scope:a.scopes}),...(0,l.ro)("github")});if(!b.ok){let a=await b.text();throw Error(`Device code request failed: ${a}`)}return await b.json()},pollToken:async(a,b)=>{let c,d=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:a.clientId,device_code:b,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),...(0,l.ro)("github")});try{c=await d.json()}catch(b){let a=await d.text();c={error:"invalid_response",error_description:a}}return{ok:d.ok,data:c}},postExchange:async a=>{let b=await (0,o.Fm)(j.Nu.copilotTokenUrl,{headers:{Authorization:`Bearer ${a.access_token}`,Accept:"application/json"},identity:"copilot",provider:"github",format:"openai"}),c=b.ok?await b.json():{},d=await (0,o.Fm)(j.Nu.userInfoUrl,{headers:{Authorization:`Bearer ${a.access_token}`,Accept:"application/json","X-GitHub-Api-Version":j.Nu.apiVersion},identity:"copilot",provider:"github",format:"openai"}),e=d.ok?await d.json():{};return{copilotToken:c,userInfo:e}},mapTokens:(a,b)=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,providerSpecificData:{copilotToken:b?.copilotToken?.token,copilotTokenExpiresAt:b?.copilotToken?.expires_at,githubUserId:b?.userInfo?.id,githubLogin:b?.userInfo?.login,githubName:b?.userInfo?.name,githubEmail:b?.userInfo?.email}})},kiro:{config:j.Tx,flowType:"device_code",requestDeviceCode:async(a,b,c={})=>{let d=("string"==typeof c.region?c.region.trim():"")||"us-east-1";(0,j.S6)(d);let e=("string"==typeof c.startUrl?c.startUrl.trim():"")||a.startUrl,f="idc"===c.authMethod?"idc":"builder-id",g=`https://oidc.${d}.amazonaws.com/client/register`,h=`https://oidc.${d}.amazonaws.com/device_authorization`,i=await (0,o.Fm)(g,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientName:a.clientName,clientType:a.clientType,scopes:a.scopes,grantTypes:a.grantTypes,issuerUrl:a.issuerUrl}),...(0,l.ro)("kiro")});if(!i.ok){let a=await i.text();throw Error(`Client registration failed: ${a}`)}let k=await i.json(),m=await (0,o.Fm)(h,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:k.clientId,clientSecret:k.clientSecret,startUrl:e}),...(0,l.ro)("kiro")});if(!m.ok){let a=await m.text();throw Error(`Device authorization failed: ${a}`)}let n=await m.json();return{device_code:n.deviceCode,user_code:n.userCode,verification_uri:n.verificationUri,verification_uri_complete:n.verificationUriComplete,expires_in:n.expiresIn,interval:n.interval||5,_clientId:k.clientId,_clientSecret:k.clientSecret,_region:d,_authMethod:f,_startUrl:e}},pollToken:async(a,b,c,d)=>{let e,f=d?._region||"us-east-1";(0,j.S6)(f);let g=(0,m.R)(d?._profileArn);if(d?._profileArn&&!g)throw Error("A valid Kiro profile ARN is required for IAM Identity Center");let h=`https://oidc.${f}.amazonaws.com/token`,i=await (0,o.Fm)(h,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:d?._clientId,clientSecret:d?._clientSecret,deviceCode:b,grantType:"urn:ietf:params:oauth:grant-type:device_code"}),...(0,l.ro)("kiro")});try{e=await i.json()}catch(b){let a=await i.text();e={error:"invalid_response",error_description:a}}if(e.accessToken){let a=(0,m.R)(e.profileArn),b=a?.profileArn||g?.profileArn||await (0,l.gR)(e.accessToken,f);if(d?._authMethod==="idc"&&!b)throw Error("Kiro did not return an enterprise profile. Check that the subscription is active, or enter a profile ARN from `kiro-cli whoami`.");return{ok:!0,data:{access_token:e.accessToken,refresh_token:e.refreshToken,expires_in:e.expiresIn,profile_arn:b,_clientId:d?._clientId,_clientSecret:d?._clientSecret,_region:d?._region,_authMethod:d?._authMethod,_startUrl:d?._startUrl}}}return{ok:!1,data:{error:e.error||"authorization_pending",error_description:e.error_description||e.message}}},mapTokens:a=>{let b=(0,l.J_)(a.access_token);return{accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,email:b,providerSpecificData:{profileArn:a?.profile_arn||null,clientId:a._clientId,clientSecret:a._clientSecret,region:a._region||"us-east-1",authMethod:a._authMethod||"builder-id",startUrl:a._startUrl||j.Tx.startUrl}}}},cursor:{config:j.WN,flowType:"import_token",mapTokens:a=>({accessToken:a.accessToken,refreshToken:null,expiresIn:a.expiresIn||86400,providerSpecificData:{machineId:a.machineId,authMethod:"imported"}})},"kimi-coding":{config:j.t,flowType:"device_code",requestDeviceCode:async a=>{let b=g().randomUUID(),c=await (0,o.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...(0,h.VK)(b)},body:new URLSearchParams({client_id:a.clientId}),...(0,l.ro)("kimi-coding")});if(!c.ok){let a=await c.text();throw Error(`Device code request failed: ${a}`)}let d=await c.json();return{device_code:d.device_code,user_code:d.user_code,verification_uri:d.verification_uri||"https://www.kimi.com/code/authorize_device",verification_uri_complete:d.verification_uri_complete||`https://www.kimi.com/code/authorize_device?user_code=${d.user_code}`,expires_in:d.expires_in,interval:d.interval||5,_kimiDeviceId:b}},pollToken:async(a,b,c,d)=>{let e,f=d?._kimiDeviceId,g=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",...(0,h.VK)(f)},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:a.clientId,device_code:b}),...(0,l.ro)("kimi-coding")});try{e=await g.json()}catch(b){let a=await g.text();e={error:"invalid_response",error_description:a}}return e.access_token&&f&&(e._kimiDeviceId=f),{ok:g.ok,data:e}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,...a._kimiDeviceId?{providerSpecificData:{deviceId:a._kimiDeviceId}}:{}})},kilocode:{config:j.MZ,flowType:"device_code",requestDeviceCode:async a=>{let b=await (0,o.Fm)(a.initiateUrl,{method:"POST",headers:{"Content-Type":"application/json"},...(0,l.ro)("kilocode")});if(!b.ok){if(429===b.status)throw Error("Too many pending authorization requests. Please try again later.");let a=await b.text();throw Error(`Device auth initiation failed: ${a}`)}let c=await b.json();return{device_code:c.code,user_code:c.code,verification_uri:c.verificationUrl,verification_uri_complete:c.verificationUrl,expires_in:c.expiresIn||300,interval:3}},pollToken:async(a,b)=>{let c=await (0,o.Fm)(`${a.pollUrlBase}/${b}`,{...(0,l.ro)("kilocode")});if(202===c.status)return{ok:!1,data:{error:"authorization_pending"}};if(403===c.status)return{ok:!1,data:{error:"access_denied",error_description:"Authorization denied by user"}};if(410===c.status)return{ok:!1,data:{error:"expired_token",error_description:"Authorization code expired"}};if(!c.ok)return{ok:!1,data:{error:"poll_failed",error_description:`Poll failed: ${c.status}`}};let d=await c.json();if("approved"===d.status&&d.token){let b=null;try{let c=await (0,o.Fm)(`${a.apiBaseUrl}/api/profile`,{headers:{Authorization:`Bearer ${d.token}`},...(0,l.ro)("kilocode")});if(c.ok){let a=await c.json();b=a.organizations?.[0]?.id||null}}catch{}return{ok:!0,data:{access_token:d.token,_userEmail:d.userEmail,_orgId:b}}}return{ok:!1,data:{error:"authorization_pending"}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:null,expiresIn:null,email:a._userEmail,...a._orgId?{providerSpecificData:{orgId:a._orgId}}:{}})},cline:{config:j.lB,flowType:"authorization_code",buildAuthUrl:(a,b)=>{let c=new URLSearchParams({client_type:"extension",callback_url:b,redirect_uri:b});return`${a.authorizeUrl}?${c.toString()}`},exchangeToken:async(a,b,c)=>{try{let a=b,c=4-a.length%4;4!==c&&(a+="=".repeat(c));let d=Buffer.from(a,"base64").toString("utf-8"),e=d.lastIndexOf("}");if(-1===e)throw Error("No JSON found in decoded code");let f=JSON.parse(d.substring(0,e+1));return{access_token:f.accessToken,refresh_token:f.refreshToken,email:f.email,firstName:f.firstName,lastName:f.lastName,expires_at:f.expiresAt}}catch(f){let d=await (0,o.Fm)(a.tokenExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:b,client_type:"extension",redirect_uri:c}),...(0,l.ro)("cline")});if(!d.ok){let a=await d.text();throw Error(`Cline token exchange failed: ${a}`)}let e=await d.json();return{access_token:e.data?.accessToken||e.accessToken,refresh_token:e.data?.refreshToken||e.refreshToken,email:e.data?.userInfo?.email||"",expires_at:e.data?.expiresAt||e.expiresAt}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_at?Math.floor((new Date(a.expires_at).getTime()-Date.now())/1e3):3600,email:a.email,providerSpecificData:{firstName:a.firstName,lastName:a.lastName}})},clinepass:{config:j.w1,flowType:"authorization_code",buildAuthUrl:(a,b)=>{let c=new URLSearchParams({client_type:"extension",callback_url:b,redirect_uri:b});return`${a.authorizeUrl}?${c.toString()}`},exchangeToken:async(a,b,c)=>{try{let a=b,c=4-a.length%4;4!==c&&(a+="=".repeat(c));let d=Buffer.from(a,"base64").toString("utf-8"),e=d.lastIndexOf("}");if(-1===e)throw Error("No JSON found in decoded code");let f=JSON.parse(d.substring(0,e+1));return{access_token:f.accessToken,refresh_token:f.refreshToken,email:f.email,firstName:f.firstName,lastName:f.lastName,expires_at:f.expiresAt}}catch(f){let d=await (0,o.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:b,client_type:"extension",redirect_uri:c}),...(0,l.ro)("clinepass")});if(!d.ok){let a=await d.text();throw Error(`ClinePass token exchange failed: ${a}`)}let e=await d.json();return{access_token:e.data?.accessToken||e.accessToken,refresh_token:e.data?.refreshToken||e.refreshToken,email:e.data?.userInfo?.email||"",expires_at:e.data?.expiresAt||e.expiresAt}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_at?Math.floor((new Date(a.expires_at).getTime()-Date.now())/1e3):3600,email:a.email,providerSpecificData:{firstName:a.firstName,lastName:a.lastName}})},gitlab:{config:j.f7,flowType:"authorization_code_pkce",buildAuthUrl:(a,b,c,d,e={})=>{let f=e.baseUrl||a.defaultBaseUrl,g=e.clientId||"",h=new URLSearchParams({client_id:g,redirect_uri:b,response_type:"code",state:c,scope:a.scope,code_challenge:d,code_challenge_method:a.codeChallengeMethod});return`${f}${a.authorizeUrlPath}?${h.toString()}`},exchangeToken:async(a,b,c,d,e,f={})=>{let g=f.baseUrl||a.defaultBaseUrl,h=f.clientId||"",i=f.clientSecret||"",j=new URLSearchParams({client_id:h,grant_type:"authorization_code",code:b,redirect_uri:c,code_verifier:d});i&&j.set("client_secret",i);let k=await (0,o.Fm)(`${g}${a.tokenUrlPath}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:j.toString(),...(0,l.ro)("gitlab")});if(!k.ok)throw Error(`GitLab token exchange failed: ${await k.text()}`);let m=await k.json(),n=await (0,o.Fm)(`${g}${a.userInfoUrlPath}`,{headers:{Authorization:`Bearer ${m.access_token}`},...(0,l.ro)("gitlab")}),p=n.ok?await n.json():{};return{...m,_user:p,_baseUrl:g,_clientId:h}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in,scope:a.scope,providerSpecificData:{username:a._user?.username||"",email:a._user?.email||a._user?.public_email||"",name:a._user?.name||"",baseUrl:a._baseUrl,clientId:a._clientId,authKind:"oauth"}})},"codebuddy-cn":{config:j.Nl,flowType:"device_code",requestDeviceCode:async a=>{let b=await (0,o.Fm)(`${a.stateUrl}?platform=${a.platform}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":a.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":"copilot.tencent.com","X-No-Authorization":"true","X-No-User-Id":"true","X-Product":"SaaS"},body:"{}",...(0,l.ro)("codebuddy-cn")});if(!b.ok)throw Error(`CodeBuddy state request failed: ${await b.text()}`);let c=await b.json();if(0!==c.code||!c.data?.state||!c.data?.authUrl)throw Error(`CodeBuddy state error: ${c.msg||"missing state/authUrl"}`);return{device_code:c.data.state,verification_uri:c.data.authUrl,user_code:"",interval:a.pollInterval/1e3,_isCodeBuddy:!0}},pollToken:async(a,b)=>{let c=await (0,o.Fm)(`${a.tokenUrl}?state=${encodeURIComponent(b)}`,{method:"GET",headers:{Accept:"application/json","User-Agent":a.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":"copilot.tencent.com","X-No-Authorization":"true","X-No-User-Id":"true","X-No-Enterprise-Id":"true","X-No-Department-Info":"true","X-Product":"SaaS"},...(0,l.ro)("codebuddy-cn")});if(!c.ok)return{ok:!1,data:{error:"request_failed"}};let d=await c.json();return 0===d.code&&d.data?.accessToken?{ok:!0,data:{access_token:d.data.accessToken,refresh_token:d.data.refreshToken||"",token_type:d.data.tokenType||"Bearer",expires_in:d.data.expiresIn}}:11217===d.code?{ok:!0,data:{error:"authorization_pending"}}:{ok:!1,data:{error:d.msg||"unknown_error"}}},mapTokens:a=>({accessToken:a.access_token,refreshToken:a.refresh_token,expiresIn:a.expires_in||86400,providerSpecificData:{}})},kimchi:{config:j.Td,flowType:"browser_token",buildAuthUrl:(a,b,c)=>{let d=(a.webAppUrl||"https://app.kimchi.dev").replace(/\/+$/,""),e=new URLSearchParams({callback:b,state:c});return`${d}/cli-auth?${e.toString()}`},exchangeToken:async(a,b)=>{let c=String(b||"").trim();if(!c)throw Error("Missing Kimchi token");let d=a.validationUrl||"https://api.cast.ai/v1/llm/openai/supported-providers",e=await (0,o.Fm)(d,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${c}`},...(0,l.ro)("kimchi")});if(!e.ok)throw Error(`Kimchi token validation failed: ${e.status}`);let f={};if(a.userInfoUrl)try{let b=await (0,o.Fm)(a.userInfoUrl,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${c}`},...(0,l.ro)("kimchi")});b.ok&&(f=await b.json())}catch{f={}}return{access_token:c,token_type:"Bearer",_kimchiUser:f}},mapTokens:a=>{let b=a._kimchiUser||{},c=b.id?String(b.id):"",d=b.username||"",e=b.email||(c?`kimchi-user-${c}`:null);return{accessToken:a.access_token,refreshToken:null,email:e,displayName:b.name||d||null,providerSpecificData:{authMethod:"browser_token",userId:c,username:d}}}}};function s(a){let b=A[a];if(!b)throw Error(`Unknown provider: ${a}`);return b}function t(){return Object.keys(A)}async function u(a,b,c){let d,e=s(a),f=e.prepareConfig?await e.prepareConfig(e.config,c||{}):e.config,{codeVerifier:g,codeChallenge:h,state:j}=(0,i.lz)(e.pkceVerifierBytes);return d="device_code"===e.flowType?null:"authorization_code_pkce"===e.flowType?e.buildAuthUrl(f,b,j,h,c||{}):e.buildAuthUrl(f,b,j,void 0,c||{}),(0,n.e_)({state:j,provider:a,codeVerifier:g,redirectUri:b||null}),{authUrl:d,state:j,codeVerifier:g,codeChallenge:h,redirectUri:b,flowType:e.flowType,fixedPort:e.fixedPort,callbackPath:e.callbackPath||"/callback"}}async function v(a,b,c,d,e,f){let g=s(a),h=g.prepareConfig?await g.prepareConfig(g.config,f||{}):g.config,i=await g.exchangeToken(h,b,c,d,e,f||{}),j=null;return g.postExchange&&(j=await g.postExchange(i)),g.mapTokens(i,j)}async function w(a,b,c){let d=s(a);if("device_code"!==d.flowType)throw Error(`Provider ${a} does not support device code flow`);return await d.requestDeviceCode(d.config,b,c||{})}async function x(a,b,c,d){let e=s(a);if("device_code"!==e.flowType)throw Error(`Provider ${a} does not support device code flow`);let f=await e.pollToken(e.config,b,c,d);if(f.ok)if(f.data.access_token){let b=null;e.postExchange&&(b=await e.postExchange(f.data));let c=e.mapTokens(f.data,b);if("kiro"===a&&!c.providerSpecificData?.profileArn){let a=await (0,l.gR)(c.accessToken,c.providerSpecificData?.region);a&&(c.providerSpecificData.profileArn=a)}return{success:!0,tokens:c}}else if("authorization_pending"===f.data.error||"slow_down"===f.data.error)return{success:!1,error:f.data.error,errorDescription:f.data.error_description||f.data.message,pending:"authorization_pending"===f.data.error};else return{success:!1,error:f.data.error||"no_access_token",errorDescription:f.data.error_description||f.data.message||"No access token received"};return{success:!1,error:f.data.error,errorDescription:f.data.error_description}}let B=!1;async function y(){if(!B){B=!0;try{let{getProviderConnections:a,updateProviderConnection:b}=await Promise.resolve().then(c.bind(c,77326));for(let c of(await a()).filter(a=>{if("codex"!==a.provider||"oauth"!==a.authType||!a.idToken)return!1;let b=!!a.email,c=!!a.providerSpecificData?.chatgptAccountId;return!b||!c})){let a=(0,l.YR)(c.idToken);if(!a.email&&!a.chatgptAccountId)continue;let d={};!c.email&&a.email&&(d.email=a.email),(a.chatgptAccountId||a.chatgptPlanType)&&(d.providerSpecificData={...c.providerSpecificData||{},chatgptAccountId:a.chatgptAccountId,chatgptPlanType:a.chatgptPlanType}),Object.keys(d).length&&await b(c.id,d)}}catch(a){B=!1,console.log("backfillCodexEmails failed:",a?.message||a)}}}d()}catch(a){d(a)}})},79791:(a,b,c)=>{c.d(b,{A9:()=>i,R8:()=>j,Sx:()=>h,mn:()=>k});var d=c(50969),e=c(83382),f=c(1100);async function g(a){let b=await a.text();try{return JSON.parse(b)}catch{return{error:"invalid_response",error_description:b}}}async function h(a){let b=new URLSearchParams({client_id:a.clientId,scope:a.scope});a.referrer&&b.set("referrer",a.referrer);let c=await (0,d.Fm)(a.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:b,...e.Ai}),f=await g(c);if(!c.ok)throw Error(`Grok CLI device code request failed: ${f.error_description||f.error||c.status}`);return f}async function i(a,b){let c=await (0,d.Fm)(a.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:b,client_id:a.clientId}),...e.Ai}),f=await g(c),h="authorization_pending"===f.error||"slow_down"===f.error;return{ok:c.ok||h,data:f}}async function j(a){try{let b=await (0,d.Fm)(`${e.Nr}/user`,{headers:(0,e.Ab)(a.access_token),...e.Ai});return{user:b.ok?await b.json():null}}catch{return{user:null}}}function k(a,b=null){let c=b?.user||{},d=(0,f.pG)(a.id_token)||(0,f.J_)(a.access_token)||c.email,e=c.userId||c.principalId||null,g=[c.firstName,c.lastName].filter(Boolean).join(" ").trim();return{accessToken:a.access_token,refreshToken:a.refresh_token||null,expiresIn:a.expires_in,scope:a.scope,...d?{email:d}:{},...g?{displayName:g}:{},providerSpecificData:{authMethod:"device_code",idToken:a.id_token||null,email:d||null,userId:e,hasGrokCodeAccess:c.hasGrokCodeAccess??null,subscriptionTier:c.subscriptionTier??null}}}}};
@@ -1 +1,38 @@
1
- "use strict";exports.id=5913,exports.ids=[5913],exports.modules={1100:(a,b,c)=>{c.d(b,{J_:()=>l,YR:()=>n,gR:()=>m,js:()=>i,pG:()=>j,ro:()=>h});var d=c(15251),e=c(50969),f=c(54383);let g=["us-east-1","eu-central-1"];function h(a){let b=d.xq[a];if(!b)throw Error(`Missing provider profile: ${a}`);return{identity:b.identity,provider:a,format:b.format}}function i(a,b){let c,d=String(a||"").trim();if(!d)throw Error(`xai discovery ${b} is empty`);try{c=new URL(d)}catch(a){throw Error(`xai discovery ${b} is invalid: ${a.message}`)}if("https:"!==c.protocol)throw Error(`xai discovery ${b} must use https: ${d}`);let e=c.hostname.toLowerCase().trim();if("x.ai"!==e&&!e.endsWith(".x.ai"))throw Error(`xai discovery ${b} host ${e} is not on x.ai`);return d}function j(a){if(!a||"string"!=typeof a)return;let b=a.split(".");if(3===b.length)try{let a=b[1].replace(/-/g,"+").replace(/_/g,"/"),c=(4-a.length%4)%4,d=Buffer.from(a+"=".repeat(c),"base64").toString("utf8"),e=JSON.parse(d);return e.email||e.preferred_username||e.sub||void 0}catch{return}}function k(a){try{if(!a||"string"!=typeof a)return null;let b=a.split(".");if(3!==b.length)return null;let c=b[1].replace(/-/g,"+").replace(/_/g,"/"),d=(4-c.length%4)%4,e=c+"=".repeat(d);return JSON.parse(Buffer.from(e,"base64").toString("utf8"))}catch{return null}}function l(a){let b=k(a);if(b)return b.email||b.preferred_username||b.sub||void 0}async function m(a,b){let c;if(!a)return null;let d="string"==typeof b?b.trim().toLowerCase():"";for(let i of"us-gov-east-1"===(c="string"==typeof b?b.trim().toLowerCase():"")||"us-gov-west-1"===c?[...new Set([c,"us-gov-east-1","us-gov-west-1"])].map(a=>`https://q-fips.${a}.amazonaws.com`):[...[...new Set(g.includes(c)?[c,...g]:g)].map(a=>`https://q.${a}.amazonaws.com`),"https://codewhisperer.us-east-1.amazonaws.com"])try{let b=await (0,e.Fm)(i,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Accept:"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({maxResults:10}),signal:AbortSignal.timeout(1e4),...h("kiro")});if(!b.ok)continue;let c=await b.json(),g=(Array.isArray(c?.profiles)?c.profiles:[]).map(a=>(0,f.R)(a?.arn||a?.profileArn)).filter(Boolean),j=g.find(a=>a.region===d);if(j)return j.profileArn;if(g[0])return g[0].profileArn}catch{}return null}function n(a){let b=k(a);if(!b)return{};let c=b["https://api.openai.com/auth"]||{};return{email:b.email,chatgptAccountId:c.chatgpt_account_id||b.account_id,chatgptPlanType:c.chatgpt_plan_type||b.plan_type}}},13073:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,S6:()=>s,Td:()=>A,Tx:()=>q,WN:()=>t,Ww:()=>C,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,qp:()=>B,t:()=>u,w1:()=>x});var d=c(21820),e=c(74570),f=c(15251);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}(?:-[a-z0-9]+)+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.kimchi},B={...f.sr["grok-cli"]},C=3e5},25467:(a,b,c)=>{c.d(b,{$N:()=>f,OK:()=>g,Zl:()=>h,lz:()=>i});var d=c(55511),e=c.n(d);function f(a=32){return e().randomBytes(a).toString("base64url")}function g(a){return e().createHash("sha256").update(a).digest("base64url")}function h(){return e().randomBytes(32).toString("base64url")}function i(a=32){let b=f(a),c=g(b);return{codeVerifier:b,codeChallenge:c,state:h()}}},25482:(a,b,c)=>{c.d(b,{U:()=>l,o:()=>m});var d=c(15251),e=c(70625);let f=d.xq.xai?.clientId,g="https://auth.x.ai",h="/oauth2/authorize",i="/oauth2/token",j="/.well-known/openid-configuration",k="/callback",l=96,m={clientId:f,issuer:g,authEndpointPath:h,tokenEndpointPath:i,discoveryPath:j,authorizeUrl:`${g}${h}`,tokenUrl:`${g}${i}`,discoveryUrl:`${g}${j}`,scope:"openid profile email offline_access grok-cli:access api:access",apiBaseUrl:"https://api.x.ai/v1",redirectUri:`http://127.0.0.1:56121${k}`,loopbackPort:56121,callbackPath:k,pkceVerifierBytes:96,refreshLeadSeconds:300,userAgent:(0,e.dV)("grok-cli")?.userAgent||"grok-cli/1.0.0",codeChallengeMethod:"S256"}}};
1
+ "use strict";exports.id=6757,exports.ids=[6757],exports.modules={1100:(a,b,c)=>{c.d(b,{J_:()=>l,YR:()=>n,gR:()=>m,js:()=>i,pG:()=>j,ro:()=>h});var d=c(15251),e=c(50969),f=c(54383);let g=["us-east-1","eu-central-1"];function h(a){let b=d.xq[a];if(!b)throw Error(`Missing provider profile: ${a}`);return{identity:b.identity,provider:a,format:b.format}}function i(a,b){let c,d=String(a||"").trim();if(!d)throw Error(`xai discovery ${b} is empty`);try{c=new URL(d)}catch(a){throw Error(`xai discovery ${b} is invalid: ${a.message}`)}if("https:"!==c.protocol)throw Error(`xai discovery ${b} must use https: ${d}`);let e=c.hostname.toLowerCase().trim();if("x.ai"!==e&&!e.endsWith(".x.ai"))throw Error(`xai discovery ${b} host ${e} is not on x.ai`);return d}function j(a){if(!a||"string"!=typeof a)return;let b=a.split(".");if(3===b.length)try{let a=b[1].replace(/-/g,"+").replace(/_/g,"/"),c=(4-a.length%4)%4,d=Buffer.from(a+"=".repeat(c),"base64").toString("utf8"),e=JSON.parse(d);return e.email||e.preferred_username||e.sub||void 0}catch{return}}function k(a){try{if(!a||"string"!=typeof a)return null;let b=a.split(".");if(3!==b.length)return null;let c=b[1].replace(/-/g,"+").replace(/_/g,"/"),d=(4-c.length%4)%4,e=c+"=".repeat(d);return JSON.parse(Buffer.from(e,"base64").toString("utf8"))}catch{return null}}function l(a){let b=k(a);if(b)return b.email||b.preferred_username||b.sub||void 0}async function m(a,b){let c;if(!a)return null;let d="string"==typeof b?b.trim().toLowerCase():"";for(let i of"us-gov-east-1"===(c="string"==typeof b?b.trim().toLowerCase():"")||"us-gov-west-1"===c?[...new Set([c,"us-gov-east-1","us-gov-west-1"])].map(a=>`https://q-fips.${a}.amazonaws.com`):[...[...new Set(g.includes(c)?[c,...g]:g)].map(a=>`https://q.${a}.amazonaws.com`),"https://codewhisperer.us-east-1.amazonaws.com"])try{let b=await (0,e.Fm)(i,{method:"POST",headers:{"Content-Type":"application/x-amz-json-1.0","x-amz-target":"AmazonCodeWhispererService.ListAvailableProfiles",Accept:"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({maxResults:10}),signal:AbortSignal.timeout(1e4),...h("kiro")});if(!b.ok)continue;let c=await b.json(),g=(Array.isArray(c?.profiles)?c.profiles:[]).map(a=>(0,f.R)(a?.arn||a?.profileArn)).filter(Boolean),j=g.find(a=>a.region===d);if(j)return j.profileArn;if(g[0])return g[0].profileArn}catch{}return null}function n(a){let b=k(a);if(!b)return{};let c=b["https://api.openai.com/auth"]||{};return{email:b.email,chatgptAccountId:c.chatgpt_account_id||b.account_id,chatgptPlanType:c.chatgpt_plan_type||b.plan_type}}},13073:(a,b,c)=>{c.d(b,{DI:()=>i,Hp:()=>k,LT:()=>j,MZ:()=>v,Nl:()=>z,Nu:()=>p,OV:()=>h,S6:()=>s,Td:()=>A,Tx:()=>q,WN:()=>t,Ww:()=>C,YT:()=>n,ZL:()=>m,cD:()=>o,f7:()=>y,hF:()=>l,lB:()=>w,qp:()=>B,t:()=>u,w1:()=>x});var d=c(21820),e=c(74570),f=c(15251);function g(){let a=(0,d.platform)(),b=(0,d.arch)();return"darwin"===a?"arm64"===b?2:1:"linux"===a?"arm64"===b?4:3:5*("win32"===a)}let h={...f.sr.claude},i={...f.sr.codex},j={...e.w3,...f.sr["gemini-cli"]},k={...f.sr.qwen},l={...f.sr.qoder},m={...f.sr.iflow},n={...e.XP,...f.sr.antigravity,loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:g(),pluginType:2})};function o(){return{ideType:9,platform:g(),pluginType:2}}({...f.sr.openai});let p={...f.sr.github},q={...f.sr.kiro},r=/^[a-z]{2}(?:-[a-z0-9]+)+-\d{1,2}$/;function s(a){if("string"!=typeof a||!r.test(a))throw Error("Invalid region");return a}let t={...f.sr.cursor,tokenStoragePaths:{linux:"~/.config/Cursor/User/globalStorage/state.vscdb",macos:"/Users/<user>/Library/Application Support/Cursor/User/globalStorage/state.vscdb",windows:"%APPDATA%\\Cursor\\User\\globalStorage\\state.vscdb"}},u={...f.sr["kimi-coding"],clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||f.xq["kimi-coding"]?.clientId},v={...f.sr.kilocode},w={...f.sr.cline},x={...f.sr.clinepass},y={...f.sr.gitlab},z={...f.sr["codebuddy-cn"]},A={...f.sr.kimchi},B={...f.sr["grok-cli"]},C=3e5},25467:(a,b,c)=>{c.d(b,{$N:()=>f,OK:()=>g,Zl:()=>h,lz:()=>i});var d=c(55511),e=c.n(d);function f(a=32){return e().randomBytes(a).toString("base64url")}function g(a){return e().createHash("sha256").update(a).digest("base64url")}function h(){return e().randomBytes(32).toString("base64url")}function i(a=32){let b=f(a),c=g(b);return{codeVerifier:b,codeChallenge:c,state:h()}}},25482:(a,b,c)=>{c.d(b,{U:()=>l,o:()=>m});var d=c(15251),e=c(70625);let f=d.xq.xai?.clientId,g="https://auth.x.ai",h="/oauth2/authorize",i="/oauth2/token",j="/.well-known/openid-configuration",k="/callback",l=96,m={clientId:f,issuer:g,authEndpointPath:h,tokenEndpointPath:i,discoveryPath:j,authorizeUrl:`${g}${h}`,tokenUrl:`${g}${i}`,discoveryUrl:`${g}${j}`,scope:"openid profile email offline_access grok-cli:access api:access",apiBaseUrl:"https://api.x.ai/v1",redirectUri:`http://127.0.0.1:56121${k}`,loopbackPort:56121,callbackPath:k,pkceVerifierBytes:96,refreshLeadSeconds:300,userAgent:(0,e.dV)("grok-cli")?.userAgent||"grok-cli/1.0.0",codeChallengeMethod:"S256"}},59581:(a,b,c)=>{c.d(b,{Pd:()=>g,e_:()=>i});var d=c(81630),e=c.n(d),f=c(1932);function g(a,b=null){return new Promise((c,d)=>{let g=e().createServer((b,c)=>{let d=new f.URL(b.url,"http://localhost");if("/callback"===d.pathname||"/auth/callback"===d.pathname){let b=Object.fromEntries(d.searchParams);c.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),c.end(`<!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Authentication Successful</title>
6
+ <style>
7
+ body { font-family: system-ui; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background: #f5f5f5; }
8
+ .container { text-align: center; padding: 2rem; background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
9
+ .success { color: #22c55e; font-size: 3rem; }
10
+ h1 { margin: 1rem 0; }
11
+ p { color: #666; }
12
+ #countdown { font-weight: bold; }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <div class="container">
17
+ <div class="success">&#10003;</div>
18
+ <h1>Authentication Successful</h1>
19
+ <p id="message">Closing in <span id="countdown">3</span> seconds...</p>
20
+ </div>
21
+ <script>
22
+ let count = 3;
23
+ const countdown = document.getElementById("countdown");
24
+ const message = document.getElementById("message");
25
+ const timer = setInterval(() => {
26
+ count--;
27
+ countdown.textContent = count;
28
+ if (count <= 0) {
29
+ clearInterval(timer);
30
+ window.close();
31
+ setTimeout(() => {
32
+ message.textContent = "Please close this tab manually.";
33
+ }, 500);
34
+ }
35
+ }, 1000);
36
+ </script>
37
+ </body>
38
+ </html>`),a(b)}else c.writeHead(404),c.end("Not found")});g.listen(b||0,"127.0.0.1",()=>{let{port:a}=g.address();c({server:g,port:a,close:()=>g.close()})}),g.on("error",a=>{"EADDRINUSE"===a.code&&b?d(Error(`Port ${b} is already in use. Please close other applications using this port.`)):d(a)})})}c(13073).DI.fixedPort;let h=new Map;function i({state:a,provider:b,codeVerifier:c,redirectUri:d}){return!!a&&!!b&&!!c&&(function(a){let b=Date.now();for(let[c,d]of a)b-d.createdAt>6e5&&a.delete(c)}(h),h.set(a,{provider:b,codeVerifier:c,redirectUri:d||null,createdAt:Date.now()}),!0)}}};
@@ -6,4 +6,4 @@ PRAGMA mmap_size = 30000000;
6
6
  PRAGMA cache_size = -64000;
7
7
  PRAGMA foreign_keys = ON;
8
8
  PRAGMA busy_timeout = 5000;
9
- `,e={_meta:{columns:{key:"TEXT PRIMARY KEY",value:"TEXT NOT NULL"}},settings:{columns:{id:"INTEGER PRIMARY KEY CHECK (id = 1)",data:"TEXT NOT NULL"}},providerConnections:{columns:{id:"TEXT PRIMARY KEY",provider:"TEXT NOT NULL",authType:"TEXT NOT NULL",name:"TEXT",email:"TEXT",priority:"INTEGER",isActive:"INTEGER DEFAULT 1",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pc_provider ON providerConnections(provider)","CREATE INDEX IF NOT EXISTS idx_pc_provider_active ON providerConnections(provider, isActive)","CREATE INDEX IF NOT EXISTS idx_pc_priority ON providerConnections(provider, priority)"]},providerNodes:{columns:{id:"TEXT PRIMARY KEY",type:"TEXT",name:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pn_type ON providerNodes(type)"]},proxyPools:{columns:{id:"TEXT PRIMARY KEY",isActive:"INTEGER DEFAULT 1",testStatus:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pp_active ON proxyPools(isActive)","CREATE INDEX IF NOT EXISTS idx_pp_status ON proxyPools(testStatus)"]},apiKeys:{columns:{id:"TEXT PRIMARY KEY",key:"TEXT UNIQUE NOT NULL",name:"TEXT",machineId:"TEXT",isActive:"INTEGER DEFAULT 1",createdAt:"TEXT NOT NULL",keyPrefix:"TEXT",lookupDigest:"TEXT",allowedModels:"TEXT",allowedCombos:"TEXT",expiresAt:"TEXT",rateLimitPerMinute:"INTEGER",concurrencyLimit:"INTEGER",spendLimitUsd:"REAL",spentUsd:"REAL NOT NULL DEFAULT 0"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)","CREATE INDEX IF NOT EXISTS idx_ak_prefix ON apiKeys(keyPrefix)","CREATE UNIQUE INDEX IF NOT EXISTS idx_ak_lookup_digest ON apiKeys(lookupDigest) WHERE lookupDigest IS NOT NULL"]},combos:{columns:{id:"TEXT PRIMARY KEY",name:"TEXT UNIQUE NOT NULL",kind:"TEXT",models:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_combo_name ON combos(name)"]},kv:{columns:{scope:"TEXT NOT NULL",key:"TEXT NOT NULL",value:"TEXT NOT NULL"},primaryKey:"PRIMARY KEY (scope, key)",indexes:["CREATE INDEX IF NOT EXISTS idx_kv_scope ON kv(scope)"]},usageHistory:{columns:{id:"INTEGER PRIMARY KEY AUTOINCREMENT",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",clientKeyId:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"TEXT",requestId:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_uh_ts ON usageHistory(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_uh_provider ON usageHistory(provider)","CREATE INDEX IF NOT EXISTS idx_uh_model ON usageHistory(model)","CREATE INDEX IF NOT EXISTS idx_uh_conn ON usageHistory(connectionId)","CREATE INDEX IF NOT EXISTS idx_uh_client_key ON usageHistory(clientKeyId)","CREATE UNIQUE INDEX IF NOT EXISTS idx_uh_request_id ON usageHistory(requestId) WHERE requestId IS NOT NULL"]},usageDaily:{columns:{dateKey:"TEXT PRIMARY KEY",data:"TEXT NOT NULL"}},requestDetails:{columns:{id:"TEXT PRIMARY KEY",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",status:"TEXT",data:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_rd_ts ON requestDetails(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_rd_provider ON requestDetails(provider)","CREATE INDEX IF NOT EXISTS idx_rd_model ON requestDetails(model)","CREATE INDEX IF NOT EXISTS idx_rd_conn ON requestDetails(connectionId)"]},fetchCache:{columns:{cacheKey:"TEXT PRIMARY KEY",kind:"TEXT",url:"TEXT",content:"TEXT NOT NULL",contentType:"TEXT",sizeBytes:"INTEGER",createdAt:"TEXT NOT NULL",expiresAt:"TEXT NOT NULL",lastAccessedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_fc_expires_at ON fetchCache(expiresAt)","CREATE INDEX IF NOT EXISTS idx_fc_last_accessed_at ON fetchCache(lastAccessedAt)"]},vault_entries:{columns:{id:"TEXT PRIMARY KEY",conversationId:"TEXT NOT NULL",toolName:"TEXT",content:"TEXT NOT NULL",sizeBytes:"INTEGER",createdAt:"TEXT NOT NULL",expiresAt:"TEXT NOT NULL",lastAccessedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_vault_conv ON vault_entries(conversationId)","CREATE INDEX IF NOT EXISTS idx_vault_expires ON vault_entries(expiresAt)","CREATE INDEX IF NOT EXISTS idx_vault_last_accessed ON vault_entries(lastAccessedAt)"]},vault_chunks:{columns:{entryId:"TEXT NOT NULL",chunkIndex:"INTEGER NOT NULL",conversationId:"TEXT NOT NULL",text:"TEXT NOT NULL"},primaryKey:"PRIMARY KEY (entryId, chunkIndex)",indexes:["CREATE INDEX IF NOT EXISTS idx_vault_chunks_conv ON vault_chunks(conversationId)"]},routing_events:{columns:{id:"INTEGER PRIMARY KEY AUTOINCREMENT",timestamp:"TEXT NOT NULL",comboName:"TEXT NOT NULL",sessionId:"TEXT",requestId:"TEXT",requestFingerprint:"TEXT",cluster:"TEXT",routerModel:"TEXT",pickedWorker:"TEXT",alternates:"TEXT",routerReason:"TEXT",routerConfidence:"TEXT",routerLatencyMs:"INTEGER",workerStatus:"INTEGER",workerLatencyMs:"INTEGER",fallbackUsed:"INTEGER DEFAULT 0",retries:"INTEGER DEFAULT 0",tokensIn:"INTEGER",tokensOut:"INTEGER",outcomeScore:"REAL",objective:"TEXT",learningVersionId:"TEXT",meta:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_re_combo_ts ON routing_events(comboName, timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_re_cluster_combo ON routing_events(cluster, comboName)","CREATE INDEX IF NOT EXISTS idx_re_worker ON routing_events(pickedWorker)","CREATE INDEX IF NOT EXISTS idx_re_request ON routing_events(comboName, requestId)"]},router_learning_versions:{columns:{id:"TEXT PRIMARY KEY",comboName:"TEXT NOT NULL",version:"INTEGER NOT NULL",createdAt:"TEXT NOT NULL",source:"TEXT",banditTable:"TEXT",learnedRules:"TEXT",fewShots:"TEXT",evalScore:"REAL",prevVersionId:"TEXT",promoted:"INTEGER DEFAULT 0",notes:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_rlv_combo ON router_learning_versions(comboName)","CREATE UNIQUE INDEX IF NOT EXISTS idx_rlv_combo_ver ON router_learning_versions(comboName, version)"]}};function f(a,b){let c=Object.entries(b.columns).map(([a,b])=>`${a} ${b}`);return b.primaryKey&&c.push(b.primaryKey),`CREATE TABLE IF NOT EXISTS ${a} (${c.join(", ")})`}},90698:(a,b,c)=>{c.d(b,{createBunSqliteAdapter:()=>f});var d=c(76040),e=c(8886);async function f(a){let{Database:b}=await Promise.resolve().then(c.t.bind(c,81787,23)),f=new b(a,{create:!0});f.exec(d.oG);let g=new Map;function h(a){let b=g.get(a);return b||(b=f.prepare(a),g.set(a,b)),b}let i=setInterval(()=>{try{f.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);"function"==typeof i.unref&&i.unref();let j=!1;function k(){if(l(),!j){j=!0,clearInterval(i);try{f.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{g.clear()}catch{}try{f.close()}catch{}}}let l=(0,e.H)(k);return{driver:"bun:sqlite",run(a,b=[]){let c=h(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>h(a).get(...b),all:(a,b=[])=>h(a).all(...b),exec:a=>f.exec(a),transaction:a=>f.transaction(a)(),checkpoint(){try{f.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close:k,raw:f}}}};
9
+ `,e={_meta:{columns:{key:"TEXT PRIMARY KEY",value:"TEXT NOT NULL"}},settings:{columns:{id:"INTEGER PRIMARY KEY CHECK (id = 1)",data:"TEXT NOT NULL"}},providerConnections:{columns:{id:"TEXT PRIMARY KEY",provider:"TEXT NOT NULL",authType:"TEXT NOT NULL",name:"TEXT",email:"TEXT",priority:"INTEGER",isActive:"INTEGER DEFAULT 1",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pc_provider ON providerConnections(provider)","CREATE INDEX IF NOT EXISTS idx_pc_provider_active ON providerConnections(provider, isActive)","CREATE INDEX IF NOT EXISTS idx_pc_priority ON providerConnections(provider, priority)"]},providerNodes:{columns:{id:"TEXT PRIMARY KEY",type:"TEXT",name:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pn_type ON providerNodes(type)"]},proxyPools:{columns:{id:"TEXT PRIMARY KEY",isActive:"INTEGER DEFAULT 1",testStatus:"TEXT",data:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_pp_active ON proxyPools(isActive)","CREATE INDEX IF NOT EXISTS idx_pp_status ON proxyPools(testStatus)"]},apiKeys:{columns:{id:"TEXT PRIMARY KEY",key:"TEXT UNIQUE NOT NULL",name:"TEXT",machineId:"TEXT",isActive:"INTEGER DEFAULT 1",createdAt:"TEXT NOT NULL",keyPrefix:"TEXT",lookupDigest:"TEXT",allowedModels:"TEXT",allowedCombos:"TEXT",expiresAt:"TEXT",rateLimitPerMinute:"INTEGER",concurrencyLimit:"INTEGER",spendLimitUsd:"REAL",spentUsd:"REAL NOT NULL DEFAULT 0"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)","CREATE INDEX IF NOT EXISTS idx_ak_prefix ON apiKeys(keyPrefix)","CREATE UNIQUE INDEX IF NOT EXISTS idx_ak_lookup_digest ON apiKeys(lookupDigest) WHERE lookupDigest IS NOT NULL"]},combos:{columns:{id:"TEXT PRIMARY KEY",name:"TEXT UNIQUE NOT NULL",kind:"TEXT",models:"TEXT NOT NULL",createdAt:"TEXT NOT NULL",updatedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_combo_name ON combos(name)"]},kv:{columns:{scope:"TEXT NOT NULL",key:"TEXT NOT NULL",value:"TEXT NOT NULL"},primaryKey:"PRIMARY KEY (scope, key)",indexes:["CREATE INDEX IF NOT EXISTS idx_kv_scope ON kv(scope)"]},usageHistory:{columns:{id:"INTEGER PRIMARY KEY AUTOINCREMENT",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",clientKeyId:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cachedTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"TEXT",requestId:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_uh_ts ON usageHistory(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_uh_provider ON usageHistory(provider)","CREATE INDEX IF NOT EXISTS idx_uh_model ON usageHistory(model)","CREATE INDEX IF NOT EXISTS idx_uh_conn ON usageHistory(connectionId)","CREATE INDEX IF NOT EXISTS idx_uh_client_key ON usageHistory(clientKeyId)","CREATE INDEX IF NOT EXISTS idx_uh_lastused ON usageHistory(model, provider, connectionId, clientKeyId, endpoint, timestamp)","CREATE UNIQUE INDEX IF NOT EXISTS idx_uh_request_id ON usageHistory(requestId) WHERE requestId IS NOT NULL"]},usageDaily:{columns:{dateKey:"TEXT PRIMARY KEY",data:"TEXT NOT NULL"}},requestDetails:{columns:{id:"TEXT PRIMARY KEY",timestamp:"TEXT NOT NULL",provider:"TEXT",model:"TEXT",connectionId:"TEXT",status:"TEXT",data:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_rd_ts ON requestDetails(timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_rd_provider ON requestDetails(provider)","CREATE INDEX IF NOT EXISTS idx_rd_model ON requestDetails(model)","CREATE INDEX IF NOT EXISTS idx_rd_conn ON requestDetails(connectionId)"]},fetchCache:{columns:{cacheKey:"TEXT PRIMARY KEY",kind:"TEXT",url:"TEXT",content:"TEXT NOT NULL",contentType:"TEXT",sizeBytes:"INTEGER",createdAt:"TEXT NOT NULL",expiresAt:"TEXT NOT NULL",lastAccessedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_fc_expires_at ON fetchCache(expiresAt)","CREATE INDEX IF NOT EXISTS idx_fc_last_accessed_at ON fetchCache(lastAccessedAt)"]},vault_entries:{columns:{id:"TEXT PRIMARY KEY",conversationId:"TEXT NOT NULL",toolName:"TEXT",content:"TEXT NOT NULL",sizeBytes:"INTEGER",createdAt:"TEXT NOT NULL",expiresAt:"TEXT NOT NULL",lastAccessedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_vault_conv ON vault_entries(conversationId)","CREATE INDEX IF NOT EXISTS idx_vault_expires ON vault_entries(expiresAt)","CREATE INDEX IF NOT EXISTS idx_vault_last_accessed ON vault_entries(lastAccessedAt)"]},vault_chunks:{columns:{entryId:"TEXT NOT NULL",chunkIndex:"INTEGER NOT NULL",conversationId:"TEXT NOT NULL",text:"TEXT NOT NULL"},primaryKey:"PRIMARY KEY (entryId, chunkIndex)",indexes:["CREATE INDEX IF NOT EXISTS idx_vault_chunks_conv ON vault_chunks(conversationId)"]},routing_events:{columns:{id:"INTEGER PRIMARY KEY AUTOINCREMENT",timestamp:"TEXT NOT NULL",comboName:"TEXT NOT NULL",sessionId:"TEXT",requestId:"TEXT",requestFingerprint:"TEXT",cluster:"TEXT",routerModel:"TEXT",pickedWorker:"TEXT",alternates:"TEXT",routerReason:"TEXT",routerConfidence:"TEXT",routerLatencyMs:"INTEGER",workerStatus:"INTEGER",workerLatencyMs:"INTEGER",fallbackUsed:"INTEGER DEFAULT 0",retries:"INTEGER DEFAULT 0",tokensIn:"INTEGER",tokensOut:"INTEGER",outcomeScore:"REAL",objective:"TEXT",learningVersionId:"TEXT",meta:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_re_combo_ts ON routing_events(comboName, timestamp DESC)","CREATE INDEX IF NOT EXISTS idx_re_cluster_combo ON routing_events(cluster, comboName)","CREATE INDEX IF NOT EXISTS idx_re_worker ON routing_events(pickedWorker)","CREATE INDEX IF NOT EXISTS idx_re_request ON routing_events(comboName, requestId)"]},router_learning_versions:{columns:{id:"TEXT PRIMARY KEY",comboName:"TEXT NOT NULL",version:"INTEGER NOT NULL",createdAt:"TEXT NOT NULL",source:"TEXT",banditTable:"TEXT",learnedRules:"TEXT",fewShots:"TEXT",evalScore:"REAL",prevVersionId:"TEXT",promoted:"INTEGER DEFAULT 0",notes:"TEXT"},indexes:["CREATE INDEX IF NOT EXISTS idx_rlv_combo ON router_learning_versions(comboName)","CREATE UNIQUE INDEX IF NOT EXISTS idx_rlv_combo_ver ON router_learning_versions(comboName, version)"]}};function f(a,b){let c=Object.entries(b.columns).map(([a,b])=>`${a} ${b}`);return b.primaryKey&&c.push(b.primaryKey),`CREATE TABLE IF NOT EXISTS ${a} (${c.join(", ")})`}},90698:(a,b,c)=>{c.d(b,{createBunSqliteAdapter:()=>f});var d=c(76040),e=c(8886);async function f(a){let{Database:b}=await Promise.resolve().then(c.t.bind(c,81787,23)),f=new b(a,{create:!0});f.exec(d.oG);let g=new Map;function h(a){let b=g.get(a);return b||(b=f.prepare(a),g.set(a,b)),b}let i=setInterval(()=>{try{f.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);"function"==typeof i.unref&&i.unref();let j=!1;function k(){if(l(),!j){j=!0,clearInterval(i);try{f.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{g.clear()}catch{}try{f.close()}catch{}}}let l=(0,e.H)(k);return{driver:"bun:sqlite",run(a,b=[]){let c=h(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>h(a).get(...b),all:(a,b=[])=>h(a).all(...b),exec:a=>f.exec(a),transaction:a=>f.transaction(a)(),checkpoint(){try{f.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close:k,raw:f}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=7133,exports.ids=[7133],exports.modules={67133:(a,b,c)=>{c.d(b,{Pt:()=>v,Tr:()=>w,getProviderCredentials:()=>t,vk:()=>u});var d=c(15717),e=c(39326),f=c(49263),g=c(87252),h=c(40615),i=c(7803),j=c(1486),k=c(77598),l=c.n(k);let m=2*c(30869).oc.tickIntervalMs,n=global.__accountSchedulerV2??={affinities:new Map};function o(a){return l().createHash("sha256").update(JSON.stringify(a)).digest("hex")}function p(a){for(let[b,c]of n.affinities)if(c.scopeHash===a)return b;return null}function q(a,b){return a.inFlight-b.inFlight||b.quota.tier-a.quota.tier||b.quota.remaining-a.quota.remaining||a.quota.resetAt-b.quota.resetAt||a.priority-b.priority||a.id.localeCompare(b.id)}function r(a){var b;let{providerId:c,candidates:d=[],clientKeyId:e=null,sessionKey:f=null,affinityTtlMs:g=18e5,quotaFreshMs:h=m,getInFlightCount:i=()=>0,now:j=Date.now()}=a||{};for(let[a,b]of n.affinities)(!b||b.expiresAt<=j)&&n.affinities.delete(a);let k=function(a,b,c){if(!c)return null;let d=b||"local-no-key";return{key:o([String(a),String(d),String(c)]),scopeHash:o([String(a),String(d)])}}(c,e,f),l=k?n.affinities.get(k.key):null;if(0===d.length)return l&&n.affinities.delete(k.key),{connection:null,reason:"no-candidates",affinityRebound:!!l,capacityLimited:!1};let r=[];for(let a of d){let b=function(a,b,c,d){let e;return{candidate:a,inFlight:Number.isFinite(e=Number(b(a.id)))&&e>0?e:0,quota:function(a,b,c){let d=a.lastQuota,e=d?.at,f=d?.remainingPercentage;if(!Number.isFinite(e)||b-e>c||!Number.isFinite(f))return{tier:1,remaining:-1,resetAt:1/0};let g=Math.max(0,Math.min(100,f));if(g>0)return{tier:2,remaining:g,resetAt:1/0};let h=new Date(d?.resetAt).getTime();return{tier:0,remaining:0,resetAt:Number.isFinite(h)&&h>b?h:1/0}}(a,c,d),priority:Number.isFinite(a.priority)?a.priority:Number.MAX_SAFE_INTEGER,id:String(a.id)}}(a,i,j,h),c=a.maxConcurrentRequests;(!Number.isInteger(c)||c<=0||b.inFlight<c)&&r.push(b)}if(0===r.length)return l&&n.affinities.delete(k.key),{connection:null,reason:"capacity-exhausted",affinityRebound:!!l,capacityLimited:!0};let s=l&&r.find(({candidate:a})=>a.id===l.connectionId);if(s)return l.expiresAt=j+g,{connection:s.candidate,reason:"session-affinity",affinityRebound:!1,capacityLimited:!1};r.sort(q);let t=r[0];return k&&function(a,b,c){let d=n.affinities.has(a.key);if(!d&&function(a){let b=0;for(let c of n.affinities.values())c.scopeHash===a&&(b+=1);return b}(a.scopeHash)>=500){let b=p(a.scopeHash);b&&n.affinities.delete(b)}if(!d&&n.affinities.size>=5e3){let b=p(a.scopeHash);if(!b)return;n.affinities.delete(b)}n.affinities.set(a.key,{connectionId:b,expiresAt:c,scopeHash:a.scopeHash})}(k,t.candidate.id,j+g),{connection:t.candidate,reason:(b=r[1])?t.inFlight!==b.inFlight?"least-inflight":t.quota.tier!==b.quota.tier||t.quota.remaining!==b.quota.remaining?"quota-headroom":t.quota.resetAt!==b.quota.resetAt?"quota-reset":t.priority!==b.priority?"priority":"connection-id":"priority",affinityRebound:!!l,capacityLimited:!1}}let s=new Map;async function t(a,b=null,c=null,g={}){var j;let k,l,m,n,o=b instanceof Set?b:b?new Set([b]):new Set,p=g?.preferredConnectionId||null,q=g?.strictPreferredConnection===!0,u=(0,h.rs)(a);return j=async()=>{let b;if(h.IS[u]?.noAuth){let a=((await (0,d.mt)()).providerStrategies||{})[u]||{},b=await (0,e.B)({proxyPoolId:a.proxyPoolId||""});return{id:"noauth",connectionName:"Public",isActive:!0,accessToken:"public",providerSpecificData:{connectionProxyEnabled:b.connectionProxyEnabled,connectionProxyUrl:b.connectionProxyUrl,connectionNoProxy:b.connectionNoProxy,connectionProxyPoolId:b.proxyPoolId||null,vercelRelayUrl:b.vercelRelayUrl||""}}}let j=await (0,d.getProviderConnections)({provider:u,isActive:!0});i.debug("AUTH",`${a} | total connections: ${j.length}, excludeIds: ${o.size>0?[...o].join(","):"none"}, model: ${c||"any"}`);let k=await (0,d.mt)(),l=(k.providerStrategies||{})[u]||{},m=l.fallbackStrategy||k.fallbackStrategy||"fill-first",n=l.accountScheduler||{},s=()=>!0===n.enabled?r({providerId:u,candidates:[],sessionKey:g?.sessionKey||null,clientKeyId:g?.clientKeyId||null,affinityTtlMs:1e3*Number(n.sessionAffinityTtlSeconds)||void 0,getInFlightCount:d.b7}):null;if(0===j.length)return s(),i.warn("AUTH",`No credentials for ${a}`),null;let t=q&&p?j.filter(a=>a.id===p):j;if(0===t.length)return s(),i.warn("AUTH",`${a} | requested connection is unavailable`),null;let v=t.filter(a=>!o.has(a.id)&&!(0,f.Bl)(a,c)),w=v.filter(a=>a.testStatus!==f.RU),x=w.length>0?w:v;if(i.debug("AUTH",`${a} | available: ${x.length}/${t.length}`),t.forEach(a=>{let b=o.has(a.id),d=(0,f.Bl)(a,c);if(b||d){let e=(0,f.kJ)(a);i.debug("AUTH",` → ${a.id?.slice(0,8)} | ${b?"excluded":""} ${d?`modelLocked(${c}) until ${e}`:""}`)}}),0===x.length){let b=s(),d=t.filter(a=>(0,f.Bl)(a,c)),e=d.map(a=>(0,f.kJ)(a)).filter(Boolean).sort()[0]||null;if(e){let g=d[0];return i.warn("AUTH",`${a} | all ${t.length} accounts locked for ${c||"all"} (${(0,f.Qo)(e)}) | lastError=${g?.lastError?.slice(0,50)}`),{allRateLimited:!0,retryAfter:e,retryAfterHuman:(0,f.Qo)(e),lastError:g?.lastError||null,lastErrorCode:g?.errorCode||null,...b?{selectionReason:b.reason,affinityRebound:b.affinityRebound}:{}}}return i.warn("AUTH",`${a} | all ${t.length} accounts unavailable`),null}let y=null,z=!1;if(p){let a=x.find(a=>a.id===p);if(a){let c=Number(a.maxConcurrentRequests);!0===n.enabled&&Number.isInteger(c)&&c>0&&(0,d.b7)(a.id)>=c||(b=a,y="explicit-pin")}}if(!b&&!0===n.enabled){let a=r({providerId:u,candidates:x,sessionKey:g?.sessionKey||null,clientKeyId:g?.clientKeyId||null,affinityTtlMs:1e3*Number(n.sessionAffinityTtlSeconds)||void 0,getInFlightCount:d.b7});if(!a.connection&&a.capacityLimited)return{allRateLimited:!0,capacityLimited:!0,retryAfter:new Date(Date.now()+1e3).toISOString(),retryAfterHuman:"retry after an in-flight request completes",lastError:"All accounts are at their concurrency limits",lastErrorCode:429,selectionReason:a.reason,affinityRebound:a.affinityRebound};b=a.connection,y=a.reason,z=a.affinityRebound}if(b);else if("round-robin"===m){let a=l.stickyRoundRobinLimit||k.stickyRoundRobinLimit||3,c=[...x].sort((a,b)=>a.lastUsedAt||b.lastUsedAt?a.lastUsedAt?b.lastUsedAt?new Date(b.lastUsedAt)-new Date(a.lastUsedAt):-1:1:(a.priority??999)-(b.priority??999))[0],e=c?.consecutiveUseCount||0;c&&c.lastUsedAt&&e<a?(b=c,await (0,d.updateProviderConnection)(b.id,{lastUsedAt:new Date().toISOString(),consecutiveUseCount:(b.consecutiveUseCount||0)+1})):(b=[...x].sort((a,b)=>a.lastUsedAt||b.lastUsedAt?a.lastUsedAt?b.lastUsedAt?new Date(a.lastUsedAt)-new Date(b.lastUsedAt):1:-1:(a.priority??999)-(b.priority??999))[0],await (0,d.updateProviderConnection)(b.id,{lastUsedAt:new Date().toISOString(),consecutiveUseCount:1})),y="round-robin"}else b=x[0],y="fill-first";i.info("AUTH",`${a} | selected ${b.id?.slice(0,8)} (${b.name||b.email||"unnamed"}) selection=${y} rebound=${z}`);let A=await (0,e.B)(b.providerSpecificData||{});return{authType:b.authType,apiKey:b.apiKey,accessToken:b.accessToken,refreshToken:b.refreshToken,idToken:b.idToken,expiresAt:b.expiresAt,expiresIn:b.expiresIn,lastRefreshAt:b.lastRefreshAt,projectId:b.projectId,connectionName:b.displayName||b.name||b.email||b.id,copilotToken:b.providerSpecificData?.copilotToken,providerSpecificData:{...b.providerSpecificData||{},connectionProxyEnabled:A.connectionProxyEnabled,connectionProxyUrl:A.connectionProxyUrl,connectionNoProxy:A.connectionNoProxy,connectionProxyPoolId:A.proxyPoolId||null,vercelRelayUrl:A.vercelRelayUrl||""},connectionId:b.id,testStatus:b.testStatus,lastError:b.lastError,_connection:b,selectionReason:y,affinityRebound:z}},l=s.get(u)||Promise.resolve(),m=new Promise(a=>{k=a}),n=l.then(()=>m,()=>m),s.set(u,n),(async()=>{await l.catch(()=>{});try{return await j()}finally{k(),s.get(u)===n&&s.delete(u)}})()}async function u(a,b,c,e=null,h=null,j=null){let k,l,m;if(!a||"noauth"===a)return{shouldFallback:!1,cooldownMs:0};let n=(await (0,d.getProviderConnections)({provider:e})).find(b=>b.id===a),o=n?.backoffLevel||0,p=!!(j&&j>Date.now());if(p?(k=!0,l=Math.min(j-Date.now(),g.fh),m=0):{shouldFallback:k,cooldownMs:l,newBackoffLevel:m}=(0,f.hk)(b,c,o),!k)return{shouldFallback:!1,cooldownMs:0};let q="string"==typeof c?c.slice(0,100):"Provider error",r=(0,f.S5)(h,l),s=n?.testStatus===f.RU;await (0,d.updateProviderConnection)(a,{...r,testStatus:s?f.RU:"unavailable",lastError:s&&n.lastError||q,errorCode:b,lastErrorAt:new Date().toISOString(),backoffLevel:m??o,...p?{lastQuota:{remainingPercentage:0,resetAt:new Date(j).toISOString(),at:Date.now()}}:{}});let t=Object.keys(r)[0],v=n?.displayName||n?.name||n?.email||a.slice(0,8);return i.warn("AUTH",`${v} locked ${t} for ${Math.round(l/1e3)}s [${b}]`),e&&b&&q&&console.error(`❌ ${e} [${b}]: ${q}`),{shouldFallback:!0,cooldownMs:l}}async function v(a,b,c=null){if(!a||"noauth"===a)return;let e=b._connection||b,f=Date.now(),g=Object.keys(e).filter(a=>a.startsWith("modelLock_"));if(!e.testStatus&&!e.lastError&&0===g.length)return;let h=g.filter(a=>{if(c&&a===`modelLock_${c}`||c&&"modelLock___all"===a)return!0;let b=e[a];return b&&new Date(b).getTime()<=f});if(0===h.length&&"unavailable"!==e.testStatus&&!e.lastError)return;let i=g.filter(a=>{if(h.includes(a))return!1;let b=e[a];return b&&new Date(b).getTime()>f}),j=Object.fromEntries(h.map(a=>[a,null]));0===i.length&&Object.assign(j,{testStatus:"active",lastError:null,lastErrorAt:null,backoffLevel:0}),await (0,d.updateProviderConnection)(a,j)}function w(a){return(0,j.d)(a.headers)}}};
@@ -2,4 +2,4 @@ exports.id=7454,exports.ids=[7454],exports.modules={23628:(a,b,c)=>{"use strict"
2
2
  ${e}${n(t)}
3
3
  `}function s(a){let b=o(a,e);if(!b)return a;let c=(0,d.Tp)(p(a,e));if(c.errors.length)throw Error(`Invalid Aider YAML: ${c.errors[0].message}`);for(let a of["openai-api-base","openai-api-key","model","alias"])b[a]?.exists?c.setIn([a],b[a].value):c.deleteIn([a]);return c.toString()}function t(a,{baseUrl:b,models:c,defaultModel:e}){let g=o(a,f)?u(a):a,h=(0,d.Tp)(g||"");if(h.errors.length)throw Error(`Invalid Hermes YAML: ${h.errors[0].message}`);let k=i(c),l=j(e,k),m=q(h.getIn(["custom_providers"])),p=Array.isArray(m)?m:[],r=p.find(a=>a?.name==="switchboard"),s=q(h.getIn(["model"])),v=p.filter(a=>a?.name!=="switchboard"),w=Object.fromEntries(k.map(a=>[a,{}]));return v.push({name:"switchboard",base_url:b,key_env:"SWITCHBOARD_API_KEY",api_mode:"chat_completions",models:w}),h.setIn(["custom_providers"],v),h.setIn(["model"],{...s&&"object"==typeof s?s:{},default:l,provider:"custom:switchboard"}),`${h.toString().trimEnd()}
4
4
  ${f}${n({previousProvider:r??null,previousModel:s??null})}
5
- `}function u(a){let b=o(a,f),c=(0,d.Tp)(p(a,f));if(c.errors.length)throw Error(`Invalid Hermes YAML: ${c.errors[0].message}`);let e=q(c.getIn(["custom_providers"]));if(Array.isArray(e)){let a=e.filter(a=>a?.name!=="switchboard");b?.previousProvider&&a.push(b.previousProvider),a.length?c.setIn(["custom_providers"],a):c.deleteIn(["custom_providers"])}return"custom:switchboard"===q(c.getIn(["model","provider"]))&&(b?.previousModel?c.setIn(["model"],b.previousModel):c.deleteIn(["model"])),c.toString()}function v(a,{baseUrl:b,apiKey:c,models:d,defaultModel:e}){let f=i(d),g=j(e,f);return{...a,model:`switchboard/${g}`,provider:{...a.provider||{},switchboard:{npm:"@ai-sdk/openai-compatible",name:"Switchboard",options:{apiKey:c,baseURL:b},models:Object.fromEntries(f.map(a=>[a,{name:k(a)}]))}}}}function w(a,{baseUrl:b,apiKey:c,models:d,defaultModel:e}){let f=i(d),g=j(e,f),h=a.providers||{},l=a.models||{};return{providers:{...h,providers:{...h.providers||{},switchboard:{type:"openai-compatible",name:"Switchboard",baseUrl:b,apiKey:c,defaultModelId:g}}},models:{...l,providers:{...l.providers||{},switchboard:{provider:{name:"Switchboard",baseUrl:b,defaultModelId:g},models:Object.fromEntries(f.map(a=>[a,{id:a,name:k(a)}]))}}}}}function x(a,{models:b,defaultModel:c}){let d=i(b),e=j(c,d),f=Object.fromEntries(Object.entries(a?.modelConfigs?.modelDefinitions&&"object"==typeof a.modelConfigs.modelDefinitions?a.modelConfigs.modelDefinitions:{}).filter(([,a])=>a?.family!=="switchboard"));return{...a,model:{...a.model||{},name:e},experimental:{...a.experimental||{},dynamicModelConfiguration:!0},modelConfigs:{...a.modelConfigs||{},modelDefinitions:{...f,...Object.fromEntries(d.map(a=>[a,{displayName:`Switchboard \xb7 ${k(a)}`,family:"switchboard",tier:"custom",isPreview:!1,isVisible:!0,features:{thinking:!0,multimodalToolUse:!0}}]))}}}}},57781:(a,b,c)=>{"use strict";c.d(b,{R:()=>h});var d=c(51455),e=c.n(d),f=c(76760),g=c.n(f);async function h(a,b,c="utf-8"){let d=g().dirname(a);await e().mkdir(d,{recursive:!0});let f=g().join(d,`.${g().basename(a)}.sb-tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{await e().writeFile(f,b,c);try{let a=await e().open(f,"r+");try{await a.sync()}finally{await a.close()}}catch{}await e().rename(f,a)}catch(a){try{await e().unlink(f)}catch{}throw a}}},68393:(a,b,c)=>{"use strict";c.d(b,{AD:()=>x,El:()=>v,JF:()=>r,LU:()=>u,Ng:()=>o,OU:()=>t,Ro:()=>h,_1:()=>s,ao:()=>l,at:()=>B,i6:()=>A,iO:()=>w,s8:()=>z,wN:()=>y});let d=Object.freeze({PASS_THROUGH:"pass-through",PROXY:"proxy",FULL_CATALOG:"full-catalog"}),e="x-switchboard-claude-mode",f="x-switchboard-claude-models",g="x-switchboard-claude-labels",h="x-switchboard-key",i="claude-switchboard-v1/",j=/^(?:claude|anthropic)-[a-z0-9][a-z0-9._-]*$/i,k=Object.freeze(["ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION"]);function l(a){let b=String(a||"");if(!b)return"";let c=0x811c9dc5;for(let a=0;a<b.length;a+=1)c^=b.charCodeAt(a),c=Math.imul(c,0x1000193);return(c>>>0).toString(16).padStart(8,"0")}let m=a=>a.replace(/(^|-)([a-z])/g,(a,b,c)=>`${b}${c.toUpperCase()}`);function n(a,b){if("string"!=typeof a)return"";for(let c of a.split(/\r?\n/)){let a=c.indexOf(":");if(!(a<0)&&c.slice(0,a).trim().toLowerCase()===b)return c.slice(a+1).trim()}return""}function o(a){return"string"==typeof a&&j.test(a)}function p(a){if(!Array.isArray(a))throw TypeError("Claude catalog models must be an array.");let b=[],c=new Set;for(let d of a){if("string"!=typeof d)throw TypeError("Each Claude catalog model must be a string.");let a=d.trim();if(a){if(/\r|\n/.test(a))throw TypeError("Claude catalog model IDs cannot contain newlines.");c.has(a)||(c.add(a),b.push(a))}}return b}function q(a){if("string"!=typeof a||!a.trim())return[];try{return p(JSON.parse(decodeURIComponent(a)))}catch{return[]}}function r(a){return q(n(a,f))}function s(a){return q(a?.get(f))}function t(a,b){if(!a||"object"!=typeof a||Array.isArray(a))return{};let c=new Set(p(b)),d={};for(let[b,e]of Object.entries(a)){if(!c.has(b))continue;let a=String(e||"").trim().replace(/[·•—–]/g," | ").replace(/[\r\n]+/g," ").replace(/\s+/g," ");a&&(d[b]=a.slice(0,48))}return d}function u(a){var b=a?.get(g);if("string"!=typeof b||!b.trim())return{};try{let a=JSON.parse(decodeURIComponent(b));return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}catch{return{}}}function v(a){let b=String(a||"").trim();if(!b)throw TypeError("A Switchboard model ID is required.");let c=b.split("/").map(encodeURIComponent).join("/");return`${i}${c}`}function w(a){if("string"!=typeof a||!a.startsWith(i))return null;let b=a.slice(i.length);if(!b)return null;try{let c=b.split("/").map(decodeURIComponent).join("/");return v(c)===a?c:null}catch{return null}}function x({baseUrl:a,gatewayKey:b,models:c=[],pickerLabels:h={}}){let i=String(a||"").trim().replace(/\/+$/,""),j=String(b||"").trim();if(!i)throw TypeError("A Switchboard endpoint is required.");if(!j)throw TypeError("A Switchboard API key is required.");let l=p(c),n=t(h,l),o=function(a=[],b={}){let c=p(a),h=[`${m(e)}: ${d.FULL_CATALOG}`,`${m(f)}: ${encodeURIComponent(JSON.stringify(p(c)))}`],i=function(a,b={}){let c=t(b,a);return 0===Object.keys(c).length?"":encodeURIComponent(JSON.stringify(c))}(c,b);return i&&h.push(`${m(g)}: ${i}`),h.join("\n")}(l,n);if(new TextEncoder().encode(o).byteLength>7168)throw TypeError("This catalog is too large for Claude Code request headers. Remove models or shorten picker labels.");let q={ANTHROPIC_API_KEY:"",ANTHROPIC_AUTH_TOKEN:j,ANTHROPIC_BASE_URL:i.endsWith("/v1")?i:`${i}/v1`,ANTHROPIC_CUSTOM_HEADERS:o,ANTHROPIC_CUSTOM_MODEL_OPTION:"",CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:"1"};for(let a of k)q[a]="";return{env:q,pickerLabels:n}}function y(a){return n(a,e).toLowerCase()===d.PASS_THROUGH}function z(a){let b=n(a,e).toLowerCase();return b===d.FULL_CATALOG||b===d.PROXY}function A(a){return a?.get(e)?.trim().toLowerCase()===d.PASS_THROUGH}function B(a){let b=a?.get(e)?.trim().toLowerCase();return b===d.FULL_CATALOG||b===d.PROXY}},78335:()=>{},92770:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DELETE:()=>S,GET:()=>O,POST:()=>Q});var d=c(49796),e=c(23211),f=c(79646),g=c(28354),h=c(79748),i=c.n(h),j=c(33873),k=c.n(j),l=c(21820),m=c.n(l),n=c(63294),o=c(23628),p=c(95510),q=c(68393),r=c(24424);let s=(0,g.promisify)(f.exec),t="switchboard",u=Promise.resolve(),v=a=>{let b=u.then(a,a);return u=b.catch(()=>{}),b},w=()=>k().join(m().homedir(),".pi","agent"),x=()=>k().join(w(),"models.json"),y=()=>k().join(w(),"settings.json"),z=()=>k().join(w(),"switchboard-backup.json"),A=()=>k().join(w(),"models.yml"),B=async()=>{try{let a="win32"===m().platform();return await s(a?"where pi":"which pi",{windowsHide:!0}),!0}catch{try{return await i().access(w()),!0}catch{return!1}}},C=async(a,b)=>{try{let b=await i().readFile(a,"utf-8"),c=JSON.parse(b);if(!c||"object"!=typeof c||Array.isArray(c))throw TypeError(`${a} must contain a JSON object`);return c}catch(a){if("ENOENT"===a.code)return b;throw a}},D=()=>C(x(),{providers:{}}),E=()=>C(y(),{}),F=async(a,b)=>{try{let b=await i().readFile(a,"utf-8"),c=""===b.trim()?{}:(0,n.qg)(b);if(!c||"object"!=typeof c||Array.isArray(c))throw TypeError(`${a} must contain a YAML object`);return c}catch(a){if("ENOENT"===a.code)return b;throw a}},G=()=>F(A(),{providers:{}}),H=a=>Array.isArray(a)?a.map(H):a&&"object"==typeof a?Object.fromEntries(Object.keys(a).sort().map(b=>[b,H(a[b])])):a,I=(a,b)=>JSON.stringify(H(a))===JSON.stringify(H(b)),J=a=>a&&"object"==typeof a&&"boolean"==typeof a.exists,K=a=>{if(null==a)return null;if(1===a.version&&"restored"===a.state)return a;if(1!==a.version||!J(a.provider)||!["defaultProvider","defaultModel","enabledModels"].every(b=>J(a.settings?.[b]))||!a.managedProvider||!a.managedSettings)throw Error("Unsupported or invalid Pi Switchboard backup file");return a},L=async(a,b,c,d)=>{await i().mkdir(w(),{recursive:!0}),await (0,p.M_)([{filePath:z(),content:d?JSON.stringify(d,null,2):null,secret:!0},{filePath:A(),content:(0,n.As)(a),secret:!0},{filePath:x(),content:JSON.stringify(b,null,2),secret:!0},{filePath:y(),content:JSON.stringify(c,null,2),secret:!0}])},M=(a,b,c)=>{("defaultProvider"!==c&&"defaultModel"!==c||a.defaultProvider===t)&&I(a[c],b?.managedSettings?.[c])&&(0,p.S3)(a,{[c]:b.settings?.[c]})};async function N(){try{if(!await B())return e.NextResponse.json({installed:!1,settings:null,message:"Pi is not installed"});let[a,b,c]=await Promise.all([G(),D(),E()]),d=a?.providers?.[t]||null,f=d||b?.providers?.[t]||null,g=Array.isArray(d?.models)?d.models:Array.isArray(b?.providers?.[t]?.models)?b.providers[t].models:[],h=g.map(a=>a?.id).filter(Boolean),i=Object.fromEntries(g.filter(a=>a?.id&&a?.name).map(a=>[a.id,a.name])),j=(c.defaultProvider===t&&h.includes(c.defaultModel)?c.defaultModel:null)||h[0]||null,k=f?.baseUrl||null,l=!!(f&&(a=>{try{let b=new URL(String(a||"")).hostname.toLowerCase();return"localhost"===b||"0.0.0.0"===b||/^127(?:\.\d{1,3}){3}$/.test(b)}catch{return!1}})(k)),m=l&&h.length>0;return e.NextResponse.json({installed:!0,hasSwitchboard:l,settings:{baseUrl:k,model:j,defaultModel:j,models:h,pickerLabels:i,apiKeySet:!!f?.apiKey,provider:t,scopeConfigured:m},configPath:A(),settingsPath:y()})}catch(a){return console.log("Error checking pi settings:",a),e.NextResponse.json({error:"Failed to check pi settings"},{status:500})}}async function O(){return v(N)}async function P(a){try{let b,c;try{b=await a.json()}catch{return e.NextResponse.json({error:"Invalid JSON body"},{status:400})}let{baseUrl:d,apiKey:f,model:g,models:h,defaultModel:i,pickerLabels:j}=b||{},[k,l,m,n]=await Promise.all([G(),D(),E(),C(z(),null)]),r=K(n),s=r?.state==="restored"?null:r,u=Array.isArray(k?.providers?.[t]?.models)?k.providers[t].models:Array.isArray(l?.providers?.[t]?.models)?l.providers[t].models:[],v=void 0===h?[g,...u.map(a=>a?.id)]:h,w=(0,o.rP)(v),x=void 0===j||j&&"object"==typeof j&&!Array.isArray(j)&&Object.values(j).every(a=>"string"==typeof a);if(!(0,o.uI)(d)||!(0,o.iU)(f)||0===w.length||!x)return e.NextResponse.json({error:"baseUrl, models, API key, or picker labels are invalid"},{status:400});let B=(c=String(d||"").replace(/\/+$/,"")).endsWith("/v1")?c:`${c}/v1`,F=f||"sk_switchboard",H=(0,o.F2)(i||g,w),I=(0,q.OU)(j,w),J=a=>{(!a.providers||"object"!=typeof a.providers||Array.isArray(a.providers))&&(a.providers={})};J(k),J(l);let M={baseUrl:B,api:"openai-completions",apiKey:F,authHeader:!0,compat:{supportsDeveloperRole:!1,supportsReasoningEffort:!0,supportsUsageInStreaming:!0},models:(0,o.L6)(w,u,I)},N={...M,discovery:{type:"openai-models-list"}},O=s?.version===1?s:{version:1,state:"active",provider:(0,p.EA)(k.providers,[t])[t],legacyProvider:(0,p.EA)(l.providers,[t])[t],settings:(0,p.EA)(m,["defaultProvider","defaultModel","enabledModels"])};k.providers[t]=N,l.providers[t]=M,m.defaultProvider=t,m.defaultModel=H;let P=((a,b)=>{if(!Array.isArray(a)||0===a.length)return;let c=a.filter(a=>"string"!=typeof a||!a.startsWith(`${t}/`));if(0!==c.length)return[...c,...b]})(m.enabledModels,w.map(a=>`${t}/${a}`));return P?m.enabledModels=P:delete m.enabledModels,O.managedProvider=N,O.managedLegacyProvider=M,O.managedSettings={defaultProvider:t,defaultModel:H,enabledModels:m.enabledModels},await L(k,l,m,O),e.NextResponse.json({success:!0,message:`Pi configured with ${w.length} model${1===w.length?"":"s"}. ${H} is the default; use /model to switch.`,pickerLabels:Object.fromEntries(M.models.map(a=>[a.id,a.name])),configPath:A(),settingsPath:y()})}catch(a){return console.log("Error updating pi settings:",a),e.NextResponse.json({error:"Failed to update pi settings"},{status:500})}}async function Q(a){return v(()=>P(a))}async function R(){try{let[a,b,c,d]=await Promise.all([G(),D(),E(),C(z(),null)]),f=K(d);if(f?.state==="restored")return e.NextResponse.json({success:!0,message:"No Switchboard Pi settings to reset"});let g=a?.providers?.[t],h=b?.providers?.[t],i=!!(g||h),j=c.defaultProvider===t||Array.isArray(c.enabledModels)&&c.enabledModels.some(a=>"string"==typeof a&&a.startsWith(`${t}/`));if(!f&&!i&&!j)return e.NextResponse.json({success:!0,message:"No Switchboard Pi settings to reset"});return g&&(!f?.managedProvider||I(g,f.managedProvider))&&(f?.version===1?(0,p.S3)(a.providers,{[t]:f.provider}):delete a.providers[t]),h&&(!f?.managedLegacyProvider||I(h,f.managedLegacyProvider))&&(f?.version===1?(0,p.S3)(b.providers,{[t]:f.legacyProvider??f.provider}):delete b.providers[t]),f?.version===1?(M(c,f,"defaultModel"),M(c,f,"defaultProvider"),M(c,f,"enabledModels")):c.defaultProvider===t&&(delete c.defaultProvider,delete c.defaultModel),!f&&Array.isArray(c.enabledModels)&&(c.enabledModels=c.enabledModels.filter(a=>"string"!=typeof a||!a.startsWith(`${t}/`)),0===c.enabledModels.length&&delete c.enabledModels),await L(a,b,c,{version:1,state:"restored"}),e.NextResponse.json({success:!0,message:"Switchboard provider removed and previous Pi model settings restored"})}catch(a){return console.log("Error resetting pi settings:",a),e.NextResponse.json({error:"Failed to reset pi settings"},{status:500})}}async function S(){return v(R)}(0,r.D)([O,Q,S]),(0,d.A)(O,"006df20c19dee00da71cfa25a30a18ee0d1b282b33",null),(0,d.A)(Q,"40ccbb57e7fd7e3ac52bcaef6c30be46bef7fb9006",null),(0,d.A)(S,"00c88cf10fb86e92db66f1f921ad06b2620134b240",null)},95510:(a,b,c)=>{"use strict";c.d(b,{EA:()=>i,M_:()=>h,S3:()=>j,Yb:()=>g});var d=c(51455),e=c.n(d),f=c(57781);async function g(a,b,{secret:c=!1}={}){if(await (0,f.R)(a,b,c?{encoding:"utf-8",mode:384}:"utf-8"),c)try{await e().chmod(a,384)}catch{}}async function h(a){let b=await Promise.all(a.map(async({filePath:a})=>{try{return{exists:!0,value:await e().readFile(a)}}catch(a){if(a?.code==="ENOENT")return{exists:!1,value:null};throw a}})),c=async({filePath:a,content:b,secret:c=!1})=>{if(null!==b)return void await g(a,b,{secret:c});try{await e().unlink(a)}catch(a){if(a?.code!=="ENOENT")throw a}};try{for(let b of a)await c(b)}catch(e){let d=(await Promise.allSettled(a.map(({filePath:a,secret:d=!1},e)=>c({filePath:a,content:b[e].exists?b[e].value:null,secret:d})))).filter(a=>"rejected"===a.status);if(d.length>0)throw AggregateError([e,...d.map(a=>a.reason)],"Failed to replace CLI files and roll them back cleanly");throw e}}function i(a,b){return Object.fromEntries(b.map(b=>[b,{exists:Object.hasOwn(a,b),value:a[b]}]))}function j(a,b){for(let[c,d]of Object.entries(b||{}))d?.exists?a[c]=d.value:delete a[c]}},96487:()=>{}};
5
+ `}function u(a){let b=o(a,f),c=(0,d.Tp)(p(a,f));if(c.errors.length)throw Error(`Invalid Hermes YAML: ${c.errors[0].message}`);let e=q(c.getIn(["custom_providers"]));if(Array.isArray(e)){let a=e.filter(a=>a?.name!=="switchboard");b?.previousProvider&&a.push(b.previousProvider),a.length?c.setIn(["custom_providers"],a):c.deleteIn(["custom_providers"])}return"custom:switchboard"===q(c.getIn(["model","provider"]))&&(b?.previousModel?c.setIn(["model"],b.previousModel):c.deleteIn(["model"])),c.toString()}function v(a,{baseUrl:b,apiKey:c,models:d,defaultModel:e}){let f=i(d),g=j(e,f);return{...a,model:`switchboard/${g}`,provider:{...a.provider||{},switchboard:{npm:"@ai-sdk/openai-compatible",name:"Switchboard",options:{apiKey:c,baseURL:b},models:Object.fromEntries(f.map(a=>[a,{name:k(a)}]))}}}}function w(a,{baseUrl:b,apiKey:c,models:d,defaultModel:e}){let f=i(d),g=j(e,f),h=a.providers||{},l=a.models||{};return{providers:{...h,providers:{...h.providers||{},switchboard:{type:"openai-compatible",name:"Switchboard",baseUrl:b,apiKey:c,defaultModelId:g}}},models:{...l,providers:{...l.providers||{},switchboard:{provider:{name:"Switchboard",baseUrl:b,defaultModelId:g},models:Object.fromEntries(f.map(a=>[a,{id:a,name:k(a)}]))}}}}}function x(a,{models:b,defaultModel:c}){let d=i(b),e=j(c,d),f=Object.fromEntries(Object.entries(a?.modelConfigs?.modelDefinitions&&"object"==typeof a.modelConfigs.modelDefinitions?a.modelConfigs.modelDefinitions:{}).filter(([,a])=>a?.family!=="switchboard"));return{...a,model:{...a.model||{},name:e},experimental:{...a.experimental||{},dynamicModelConfiguration:!0},modelConfigs:{...a.modelConfigs||{},modelDefinitions:{...f,...Object.fromEntries(d.map(a=>[a,{displayName:`Switchboard \xb7 ${k(a)}`,family:"switchboard",tier:"custom",isPreview:!1,isVisible:!0,features:{thinking:!0,multimodalToolUse:!0}}]))}}}}},57781:(a,b,c)=>{"use strict";c.d(b,{R:()=>h});var d=c(51455),e=c.n(d),f=c(76760),g=c.n(f);async function h(a,b,c="utf-8"){let d=g().dirname(a);await e().mkdir(d,{recursive:!0});let f=g().join(d,`.${g().basename(a)}.sb-tmp-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{await e().writeFile(f,b,c);try{let a=await e().open(f,"r+");try{await a.sync()}finally{await a.close()}}catch{}await e().rename(f,a)}catch(a){try{await e().unlink(f)}catch{}throw a}}},68393:(a,b,c)=>{"use strict";c.d(b,{AD:()=>x,El:()=>v,JF:()=>r,LU:()=>u,Ng:()=>o,OU:()=>t,Ro:()=>h,_1:()=>s,ao:()=>l,at:()=>B,i6:()=>A,iO:()=>w,s8:()=>z,wN:()=>y});let d=Object.freeze({PASS_THROUGH:"pass-through",PROXY:"proxy",FULL_CATALOG:"full-catalog"}),e="x-switchboard-claude-mode",f="x-switchboard-claude-models",g="x-switchboard-claude-labels",h="x-switchboard-key",i="claude-switchboard-v1/",j=/^(?:claude|anthropic)-[a-z0-9][a-z0-9._-]*$/i,k=Object.freeze(["ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL_NAME","ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL_NAME","ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_FABLE_MODEL","ANTHROPIC_DEFAULT_FABLE_MODEL_NAME","ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION","ANTHROPIC_DEFAULT_HAIKU_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME","ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION"]);function l(a){let b=String(a||"");if(!b)return"";let c=0x811c9dc5;for(let a=0;a<b.length;a+=1)c^=b.charCodeAt(a),c=Math.imul(c,0x1000193);return(c>>>0).toString(16).padStart(8,"0")}let m=a=>a.replace(/(^|-)([a-z])/g,(a,b,c)=>`${b}${c.toUpperCase()}`);function n(a,b){if("string"!=typeof a)return"";for(let c of a.split(/\r?\n/)){let a=c.indexOf(":");if(!(a<0)&&c.slice(0,a).trim().toLowerCase()===b)return c.slice(a+1).trim()}return""}function o(a){return"string"==typeof a&&j.test(a)}function p(a){if(!Array.isArray(a))throw TypeError("Claude catalog models must be an array.");let b=[],c=new Set;for(let d of a){if("string"!=typeof d)throw TypeError("Each Claude catalog model must be a string.");let a=d.trim();if(a){if(/\r|\n/.test(a))throw TypeError("Claude catalog model IDs cannot contain newlines.");c.has(a)||(c.add(a),b.push(a))}}return b}function q(a){if("string"!=typeof a||!a.trim())return[];try{return p(JSON.parse(decodeURIComponent(a)))}catch{return[]}}function r(a){return q(n(a,f))}function s(a){return q(a?.get(f))}function t(a,b){if(!a||"object"!=typeof a||Array.isArray(a))return{};let c=new Set(p(b)),d={};for(let[b,e]of Object.entries(a)){if(!c.has(b))continue;let a=String(e||"").trim().replace(/[·•—–]/g," | ").replace(/[\r\n]+/g," ").replace(/\s+/g," ");a&&(d[b]=a.slice(0,48))}return d}function u(a){var b=a?.get(g);if("string"!=typeof b||!b.trim())return{};try{let a=JSON.parse(decodeURIComponent(b));return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}catch{return{}}}function v(a){let b=String(a||"").trim();if(!b)throw TypeError("A Switchboard model ID is required.");let c=b.split("/").map(encodeURIComponent).join("/");return`${i}${c}`}function w(a){if("string"!=typeof a||!a.startsWith(i))return null;let b=a.slice(i.length);if(!b)return null;try{let c=b.split("/").map(decodeURIComponent).join("/");return v(c)===a?c:null}catch{return null}}function x({baseUrl:a,gatewayKey:b,models:c=[],pickerLabels:h={}}){let i=String(a||"").trim().replace(/\/+$/,""),j=String(b||"").trim();if(!i)throw TypeError("A Switchboard endpoint is required.");if(!j)throw TypeError("A Switchboard API key is required.");let l=p(c),n=t(h,l),o=function(a=[],b={}){let c=p(a),h=[`${m(e)}: ${d.FULL_CATALOG}`,`${m(f)}: ${encodeURIComponent(JSON.stringify(p(c)))}`],i=function(a,b={}){let c=t(b,a);return 0===Object.keys(c).length?"":encodeURIComponent(JSON.stringify(c))}(c,b);return i&&h.push(`${m(g)}: ${i}`),h.join("\n")}(l,n);if(new TextEncoder().encode(o).byteLength>7168)throw TypeError("This catalog is too large for Claude Code request headers. Remove models or shorten picker labels.");let q={ANTHROPIC_API_KEY:"",ANTHROPIC_AUTH_TOKEN:j,ANTHROPIC_BASE_URL:i.endsWith("/v1")?i:`${i}/v1`,ANTHROPIC_CUSTOM_HEADERS:o,ANTHROPIC_CUSTOM_MODEL_OPTION:"",CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:"1"};for(let a of k)q[a]="";return{env:q,pickerLabels:n}}function y(a){return n(a,e).toLowerCase()===d.PASS_THROUGH}function z(a){let b=n(a,e).toLowerCase();return b===d.FULL_CATALOG||b===d.PROXY}function A(a){return a?.get(e)?.trim().toLowerCase()===d.PASS_THROUGH}function B(a){let b=a?.get(e)?.trim().toLowerCase();return b===d.FULL_CATALOG||b===d.PROXY}},78335:()=>{},92770:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DELETE:()=>S,GET:()=>O,POST:()=>Q});var d=c(49796),e=c(23211),f=c(79646),g=c(28354),h=c(79748),i=c.n(h),j=c(33873),k=c.n(j),l=c(21820),m=c.n(l),n=c(63294),o=c(23628),p=c(95510),q=c(68393),r=c(24424);let s=(0,g.promisify)(f.exec),t="switchboard",u=Promise.resolve(),v=a=>{let b=u.then(a,a);return u=b.catch(()=>{}),b},w=()=>k().join(m().homedir(),".pi","agent"),x=()=>k().join(w(),"models.json"),y=()=>k().join(w(),"settings.json"),z=()=>k().join(w(),"switchboard-backup.json"),A=()=>k().join(w(),"models.yml"),B=async()=>{try{let a="win32"===m().platform();return await s(a?"where pi":"which pi",{windowsHide:!0}),!0}catch{try{return await i().access(w()),!0}catch{return!1}}},C=async(a,b)=>{try{let b=await i().readFile(a,"utf-8"),c=JSON.parse(b);if(!c||"object"!=typeof c||Array.isArray(c))throw TypeError(`${a} must contain a JSON object`);return c}catch(a){if("ENOENT"===a.code)return b;throw a}},D=()=>C(x(),{providers:{}}),E=()=>C(y(),{}),F=async(a,b)=>{try{let b=await i().readFile(a,"utf-8"),c=""===b.trim()?{}:(0,n.qg)(b);if(!c||"object"!=typeof c||Array.isArray(c))throw TypeError(`${a} must contain a YAML object`);return c}catch(a){if("ENOENT"===a.code)return b;throw a}},G=()=>F(A(),{providers:{}}),H=a=>Array.isArray(a)?a.map(H):a&&"object"==typeof a?Object.fromEntries(Object.keys(a).sort().map(b=>[b,H(a[b])])):a,I=(a,b)=>JSON.stringify(H(a))===JSON.stringify(H(b)),J=a=>a&&"object"==typeof a&&"boolean"==typeof a.exists,K=a=>{if(null==a)return null;if(1===a.version&&"restored"===a.state)return a;if(1!==a.version||!J(a.provider)||!["defaultProvider","defaultModel","enabledModels"].every(b=>J(a.settings?.[b]))||!a.managedProvider||!a.managedSettings)throw Error("Unsupported or invalid Pi Switchboard backup file");return a},L=async(a,b,c,d)=>{await i().mkdir(w(),{recursive:!0}),await (0,p.M_)([{filePath:z(),content:d?JSON.stringify(d,null,2):null,secret:!0},{filePath:A(),content:(0,n.As)(a),secret:!0},{filePath:x(),content:JSON.stringify(b,null,2),secret:!0},{filePath:y(),content:JSON.stringify(c,null,2),secret:!0}])},M=(a,b,c)=>{("defaultProvider"!==c&&"defaultModel"!==c||a.defaultProvider===t)&&I(a[c],b?.managedSettings?.[c])&&(0,p.S3)(a,{[c]:b.settings?.[c]})};async function N(){try{if(!await B())return e.NextResponse.json({installed:!1,settings:null,message:"Pi is not installed"});let[a,b,c]=await Promise.all([G(),D(),E()]),d=a?.providers?.[t]||null,f=d||b?.providers?.[t]||null,g=Array.isArray(d?.models)?d.models:Array.isArray(b?.providers?.[t]?.models)?b.providers[t].models:[],h=g.map(a=>a?.id).filter(Boolean),i=Object.fromEntries(g.filter(a=>a?.id&&a?.name).map(a=>[a.id,a.name])),j=(c.defaultProvider===t&&h.includes(c.defaultModel)?c.defaultModel:null)||h[0]||null,k=f?.baseUrl||null,l=!!(f&&(a=>{try{let b=new URL(String(a||"")).hostname.toLowerCase();return"localhost"===b||"0.0.0.0"===b||/^127(?:\.\d{1,3}){3}$/.test(b)}catch{return!1}})(k)),m=l&&h.length>0;return e.NextResponse.json({installed:!0,hasSwitchboard:l,settings:{baseUrl:k,model:j,defaultModel:j,models:h,pickerLabels:i,apiKeySet:!!f?.apiKey,provider:t,scopeConfigured:m},configPath:A(),settingsPath:y()})}catch(a){return console.log("Error checking pi settings:",a),e.NextResponse.json({error:"Failed to check pi settings"},{status:500})}}async function O(){return v(N)}async function P(a){try{let b,c;try{b=await a.json()}catch{return e.NextResponse.json({error:"Invalid JSON body"},{status:400})}let{baseUrl:d,apiKey:f,model:g,models:h,defaultModel:i,pickerLabels:j}=b||{},[k,l,m,n]=await Promise.all([G(),D(),E(),C(z(),null)]),r=K(n),s=r?.state==="restored"?null:r,u=Array.isArray(k?.providers?.[t]?.models)?k.providers[t].models:Array.isArray(l?.providers?.[t]?.models)?l.providers[t].models:[],v=void 0===h?[g,...u.map(a=>a?.id)]:h,w=(0,o.rP)(v),x=void 0===j||j&&"object"==typeof j&&!Array.isArray(j)&&Object.values(j).every(a=>"string"==typeof a);if(!(0,o.uI)(d)||!(0,o.iU)(f)||0===w.length||!x)return e.NextResponse.json({error:"baseUrl, models, API key, or picker labels are invalid"},{status:400});let B=(c=String(d||"").replace(/\/+$/,"")).endsWith("/v1")?c:`${c}/v1`,F=f||"sk_switchboard",H=(0,o.F2)(i||g,w),I=(0,q.OU)(j,w),J=a=>{(!a.providers||"object"!=typeof a.providers||Array.isArray(a.providers))&&(a.providers={})};J(k),J(l);let M={baseUrl:B,api:"openai-completions",apiKey:F,authHeader:!0,compat:{supportsDeveloperRole:!1,supportsReasoningEffort:!0,supportsUsageInStreaming:!0},models:(0,o.L6)(w,u,I)},N={...M,discovery:{type:"openai-models-list"}},O=s?.version===1?s:{version:1,state:"active",provider:(0,p.EA)(k.providers,[t])[t],legacyProvider:(0,p.EA)(l.providers,[t])[t],settings:(0,p.EA)(m,["defaultProvider","defaultModel","enabledModels"])};k.providers[t]=N,l.providers[t]=M,m.defaultProvider=t,m.defaultModel=H;let P=((a,b)=>{if(!Array.isArray(a)||0===a.length)return;let c=a.filter(a=>"string"!=typeof a||!a.startsWith(`${t}/`));if(0!==c.length)return[...c,...b]})(m.enabledModels,w.map(a=>`${t}/${a}`));return P?m.enabledModels=P:delete m.enabledModels,O.managedProvider=N,O.managedLegacyProvider=M,O.managedSettings={defaultProvider:t,defaultModel:H,enabledModels:m.enabledModels},await L(k,l,m,O),e.NextResponse.json({success:!0,message:`Pi configured with ${w.length} model${1===w.length?"":"s"}. ${H} is the default; use /model to switch.`,pickerLabels:Object.fromEntries(M.models.map(a=>[a.id,a.name])),configPath:A(),settingsPath:y()})}catch(a){return console.log("Error updating pi settings:",a),e.NextResponse.json({error:"Failed to update pi settings"},{status:500})}}async function Q(a){return v(()=>P(a))}async function R(){try{let[a,b,c,d]=await Promise.all([G(),D(),E(),C(z(),null)]),f=K(d);if(f?.state==="restored")return e.NextResponse.json({success:!0,message:"No Switchboard Pi settings to reset"});let g=a?.providers?.[t],h=b?.providers?.[t],i=!!(g||h),j=c.defaultProvider===t||Array.isArray(c.enabledModels)&&c.enabledModels.some(a=>"string"==typeof a&&a.startsWith(`${t}/`));if(!f&&!i&&!j)return e.NextResponse.json({success:!0,message:"No Switchboard Pi settings to reset"});return g&&(!f?.managedProvider||I(g,f.managedProvider))&&(f?.version===1?(0,p.S3)(a.providers,{[t]:f.provider}):delete a.providers[t]),h&&(!f?.managedLegacyProvider||I(h,f.managedLegacyProvider))&&(f?.version===1?(0,p.S3)(b.providers,{[t]:f.legacyProvider??f.provider}):delete b.providers[t]),f?.version===1?(M(c,f,"defaultModel"),M(c,f,"defaultProvider"),M(c,f,"enabledModels")):c.defaultProvider===t&&(delete c.defaultProvider,delete c.defaultModel),!f&&Array.isArray(c.enabledModels)&&(c.enabledModels=c.enabledModels.filter(a=>"string"!=typeof a||!a.startsWith(`${t}/`)),0===c.enabledModels.length&&delete c.enabledModels),await L(a,b,c,{version:1,state:"restored"}),e.NextResponse.json({success:!0,message:"Switchboard provider removed and previous Pi model settings restored"})}catch(a){return console.log("Error resetting pi settings:",a),e.NextResponse.json({error:"Failed to reset pi settings"},{status:500})}}async function S(){return v(R)}(0,r.D)([O,Q,S]),(0,d.A)(O,"00df5f31637c2554d147edbf2d782d316a67b9ff1b",null),(0,d.A)(Q,"408c6c1a66af03203836dffe08e2517cb7a29cc040",null),(0,d.A)(S,"0098d4075b2ba0f113fcbf288a5c5f103c30eb930e",null)},95510:(a,b,c)=>{"use strict";c.d(b,{EA:()=>i,M_:()=>h,S3:()=>j,Yb:()=>g});var d=c(51455),e=c.n(d),f=c(57781);async function g(a,b,{secret:c=!1}={}){if(await (0,f.R)(a,b,c?{encoding:"utf-8",mode:384}:"utf-8"),c)try{await e().chmod(a,384)}catch{}}async function h(a){let b=await Promise.all(a.map(async({filePath:a})=>{try{return{exists:!0,value:await e().readFile(a)}}catch(a){if(a?.code==="ENOENT")return{exists:!1,value:null};throw a}})),c=async({filePath:a,content:b,secret:c=!1})=>{if(null!==b)return void await g(a,b,{secret:c});try{await e().unlink(a)}catch(a){if(a?.code!=="ENOENT")throw a}};try{for(let b of a)await c(b)}catch(e){let d=(await Promise.allSettled(a.map(({filePath:a,secret:d=!1},e)=>c({filePath:a,content:b[e].exists?b[e].value:null,secret:d})))).filter(a=>"rejected"===a.status);if(d.length>0)throw AggregateError([e,...d.map(a=>a.reason)],"Failed to replace CLI files and roll them back cleanly");throw e}}function i(a,b){return Object.fromEntries(b.map(b=>[b,{exists:Object.hasOwn(a,b),value:a[b]}]))}function j(a,b){for(let[c,d]of Object.entries(b||{}))d?.exists?a[c]=d.value:delete a[c]}},96487:()=>{}};