zevairouter 1.0.12 → 1.0.14

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 (637) hide show
  1. package/README.md +125 -44
  2. package/cli/app/.next-cli-build/BUILD_ID +1 -1
  3. package/cli/app/.next-cli-build/app-path-routes-manifest.json +3 -3
  4. package/cli/app/.next-cli-build/build-manifest.json +2 -2
  5. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js +1 -1
  6. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js.nft.json +1 -1
  7. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
  8. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  9. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  10. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  11. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  12. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  13. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  14. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  15. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  16. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  17. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  18. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  19. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  20. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  21. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  22. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  23. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  24. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  25. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  26. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  27. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  28. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  29. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  30. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  31. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  32. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  33. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  34. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  35. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  36. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  37. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  38. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  39. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  40. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  41. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  42. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  43. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  44. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +2 -2
  45. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  46. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  47. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  48. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  49. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  50. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  51. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  52. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  53. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  54. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  55. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  56. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  57. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  58. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  59. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +2 -2
  60. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  61. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  62. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  63. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  64. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  65. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  66. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  67. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  68. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  69. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  70. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  71. package/cli/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  72. package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  73. package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
  74. package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  75. package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  76. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  77. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  78. package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  79. package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  80. package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  81. package/cli/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  82. package/cli/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  83. package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  84. package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
  85. package/cli/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  86. package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  87. package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  88. package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
  89. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  90. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  91. package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  92. package/cli/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  93. package/cli/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  94. package/cli/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  95. package/cli/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  96. package/cli/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  97. package/cli/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
  98. package/cli/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  99. package/cli/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
  100. package/cli/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  101. package/cli/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  102. package/cli/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  103. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
  104. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  105. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  106. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  107. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  108. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  109. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  110. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  111. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js +1 -1
  112. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js.nft.json +1 -1
  113. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  114. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  115. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  116. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  117. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  118. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  119. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  120. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  121. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  122. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  123. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  124. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  125. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  126. package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  127. package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  128. package/cli/app/.next-cli-build/server/app/api/combos/route.js +1 -1
  129. package/cli/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  130. package/cli/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  131. package/cli/app/.next-cli-build/server/app/api/init/route.js +1 -1
  132. package/cli/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  133. package/cli/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  134. package/cli/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  135. package/cli/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  136. package/cli/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  137. package/cli/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  138. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  139. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  140. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  141. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  142. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  143. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  144. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  145. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  146. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
  147. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  148. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  149. package/cli/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
  150. package/cli/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  151. package/cli/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
  152. package/cli/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  153. package/cli/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  154. package/cli/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  155. package/cli/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
  156. package/cli/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  157. package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
  158. package/cli/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  159. package/cli/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  160. package/cli/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  161. package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  162. package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  163. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js +1 -1
  164. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  165. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
  166. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  167. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js +1 -1
  168. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js.nft.json +1 -1
  169. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js +1 -1
  170. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js.nft.json +1 -1
  171. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js +1 -1
  172. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js.nft.json +1 -1
  173. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js +1 -1
  174. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  175. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
  176. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  177. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js +1 -1
  178. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js.nft.json +1 -1
  179. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/latest/route.js +1 -1
  180. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/latest/route.js.nft.json +1 -1
  181. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/route.js +1 -1
  182. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/route.js.nft.json +1 -1
  183. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-token/route.js +1 -1
  184. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-token/route.js.nft.json +1 -1
  185. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/quota-cookie/route.js +1 -1
  186. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/quota-cookie/route.js.nft.json +1 -1
  187. package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  188. package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  189. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  190. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  191. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  192. package/cli/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
  193. package/cli/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  194. package/cli/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
  195. package/cli/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  196. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  197. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js +1 -1
  198. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  199. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
  200. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  201. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/route.js +1 -1
  202. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/route.js.nft.json +1 -1
  203. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/latest/route.js +1 -1
  204. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/latest/route.js.nft.json +1 -1
  205. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/route.js +1 -1
  206. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/route.js.nft.json +1 -1
  207. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  208. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  209. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  210. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  211. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  212. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/cancel/route.js +1 -1
  213. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  214. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
  215. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  216. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/route.js +1 -1
  217. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/route.js.nft.json +1 -1
  218. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/latest/route.js +1 -1
  219. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/latest/route.js.nft.json +1 -1
  220. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/route.js +1 -1
  221. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/route.js.nft.json +1 -1
  222. package/cli/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
  223. package/cli/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  224. package/cli/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  225. package/cli/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  226. package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  227. package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  228. package/cli/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  229. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  230. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  231. package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  232. package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  233. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  234. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  235. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  236. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  237. package/cli/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  238. package/cli/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  239. package/cli/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  240. package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  241. package/cli/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  242. package/cli/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  243. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  244. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  245. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  246. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  247. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
  248. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  249. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  250. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  251. package/cli/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +1 -1
  252. package/cli/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  253. package/cli/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +1 -1
  254. package/cli/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  255. package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
  256. package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  257. package/cli/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +1 -1
  258. package/cli/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  259. package/cli/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  260. package/cli/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  261. package/cli/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  262. package/cli/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
  263. package/cli/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  264. package/cli/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  265. package/cli/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  266. package/cli/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  267. package/cli/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  268. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  269. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  270. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  271. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  272. package/cli/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  273. package/cli/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  274. package/cli/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  275. package/cli/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  276. package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  277. package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  278. package/cli/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  279. package/cli/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  280. package/cli/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  281. package/cli/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  282. package/cli/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
  283. package/cli/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  284. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
  285. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  286. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  287. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  288. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  289. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  290. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +1 -1
  291. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  292. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  293. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  294. package/cli/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  295. package/cli/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  296. package/cli/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  297. package/cli/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  298. package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  299. package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  300. package/cli/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  301. package/cli/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  302. package/cli/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  303. package/cli/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  304. package/cli/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  305. package/cli/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  306. package/cli/app/.next-cli-build/server/app/api/usage/stream/route.js +2 -2
  307. package/cli/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  308. package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  309. package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  310. package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  311. package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  312. package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  313. package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  314. package/cli/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  315. package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  316. package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  317. package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  318. package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  319. package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  320. package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  321. package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  322. package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  323. package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  324. package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  325. package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  326. package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  327. package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  328. package/cli/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  329. package/cli/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  330. package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  331. package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  332. package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  333. package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  334. package/cli/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  335. package/cli/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  336. package/cli/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  337. package/cli/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  338. package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  339. package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  340. package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  341. package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  342. package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  343. package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  344. package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
  345. package/cli/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  346. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  347. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  348. package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  349. package/cli/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  350. package/cli/app/.next-cli-build/server/app/callback/page.js +1 -1
  351. package/cli/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  352. package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  353. package/cli/app/.next-cli-build/server/app/callback.html +1 -1
  354. package/cli/app/.next-cli-build/server/app/callback.rsc +4 -4
  355. package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  356. package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  357. package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
  358. package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  359. package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  360. package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  361. package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
  362. package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +6 -6
  363. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
  364. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
  365. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  366. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  367. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +6 -6
  368. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
  369. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +4 -4
  370. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +2 -2
  371. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  372. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
  373. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  374. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  375. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  376. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  377. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  378. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  379. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  380. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  381. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  382. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  383. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  384. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  385. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  386. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  387. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  388. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  389. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  390. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  391. package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  392. package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
  393. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  394. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  395. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  396. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  397. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  398. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  399. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  400. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  401. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  402. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
  403. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  404. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  405. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  406. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  407. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  408. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  409. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  410. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  411. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  412. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
  413. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  414. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  415. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  416. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  417. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  418. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  419. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  420. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  421. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  422. package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  423. package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  424. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  425. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  426. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  427. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  428. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  429. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  430. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  431. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  432. package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  433. package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -6
  434. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  435. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  436. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  437. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  438. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  439. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  440. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  441. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  442. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  443. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
  444. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  445. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  446. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  447. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  448. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  449. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  450. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  451. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  452. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  453. package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  454. package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
  455. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  456. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  457. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  458. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  459. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  460. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  461. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  462. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  463. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  464. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
  465. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  466. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  467. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  468. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  469. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  470. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  471. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  472. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  473. package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  474. package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
  475. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  476. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  477. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  478. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  479. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  480. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  481. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  482. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  483. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  484. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  485. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  486. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  487. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  488. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  489. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  490. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  491. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  492. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  493. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  494. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  495. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  496. package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  497. package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +6 -6
  498. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  499. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  500. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  501. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  502. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
  503. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  504. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
  505. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
  506. package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  507. package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
  508. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  509. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  510. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  511. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  512. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  513. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  514. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  515. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  516. package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  517. package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
  518. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  519. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  520. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  521. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  522. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  523. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  524. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  525. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  526. package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
  527. package/cli/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  528. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  529. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  530. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  531. package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  532. package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  533. package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
  534. package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  535. package/cli/app/.next-cli-build/server/app/index.html +1 -1
  536. package/cli/app/.next-cli-build/server/app/index.rsc +4 -4
  537. package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  538. package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  539. package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  540. package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
  541. package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  542. package/cli/app/.next-cli-build/server/app/landing/page.js +1 -1
  543. package/cli/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  544. package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  545. package/cli/app/.next-cli-build/server/app/landing.html +1 -1
  546. package/cli/app/.next-cli-build/server/app/landing.rsc +4 -4
  547. package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +4 -4
  548. package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  549. package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
  550. package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  551. package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  552. package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  553. package/cli/app/.next-cli-build/server/app/login/page.js +1 -1
  554. package/cli/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  555. package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  556. package/cli/app/.next-cli-build/server/app/login.html +1 -1
  557. package/cli/app/.next-cli-build/server/app/login.rsc +5 -5
  558. package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
  559. package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  560. package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
  561. package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  562. package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  563. package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  564. package/cli/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  565. package/cli/app/.next-cli-build/server/app/page.js +1 -1
  566. package/cli/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  567. package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  568. package/cli/app/.next-cli-build/server/app-paths-manifest.json +3 -3
  569. package/cli/app/.next-cli-build/server/chunks/2777.js +1 -0
  570. package/cli/app/.next-cli-build/server/chunks/3104.js +1 -1
  571. package/cli/app/.next-cli-build/server/chunks/3110.js +1 -1
  572. package/cli/app/.next-cli-build/server/chunks/3159.js +1 -0
  573. package/cli/app/.next-cli-build/server/chunks/318.js +1 -1
  574. package/cli/app/.next-cli-build/server/chunks/{7879.js → 3188.js} +3 -3
  575. package/cli/app/.next-cli-build/server/chunks/3593.js +1 -1
  576. package/cli/app/.next-cli-build/server/chunks/4043.js +14 -0
  577. package/cli/app/.next-cli-build/server/chunks/4055.js +1 -1
  578. package/cli/app/.next-cli-build/server/chunks/4161.js +1 -0
  579. package/cli/app/.next-cli-build/server/chunks/4739.js +1 -1
  580. package/cli/app/.next-cli-build/server/chunks/4746.js +1 -1
  581. package/cli/app/.next-cli-build/server/chunks/4780.js +1 -1
  582. package/cli/app/.next-cli-build/server/chunks/5024.js +1 -0
  583. package/cli/app/.next-cli-build/server/chunks/507.js +1 -1
  584. package/cli/app/.next-cli-build/server/chunks/5217.js +1 -1
  585. package/cli/app/.next-cli-build/server/chunks/5258.js +1 -1
  586. package/cli/app/.next-cli-build/server/chunks/6896.js +1 -1
  587. package/cli/app/.next-cli-build/server/chunks/698.js +1 -1
  588. package/cli/app/.next-cli-build/server/chunks/7153.js +1 -1
  589. package/cli/app/.next-cli-build/server/chunks/7965.js +1 -1
  590. package/cli/app/.next-cli-build/server/chunks/{1517.js → 8255.js} +1 -1
  591. package/cli/app/.next-cli-build/server/chunks/8520.js +1 -1
  592. package/cli/app/.next-cli-build/server/chunks/8590.js +1 -1
  593. package/cli/app/.next-cli-build/server/chunks/891.js +1 -1
  594. package/cli/app/.next-cli-build/server/chunks/915.js +1 -1
  595. package/cli/app/.next-cli-build/server/chunks/9326.js +1 -1
  596. package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  597. package/cli/app/.next-cli-build/server/middleware.js +2 -2
  598. package/cli/app/.next-cli-build/server/pages/404.html +1 -1
  599. package/cli/app/.next-cli-build/server/pages/500.html +1 -1
  600. package/cli/app/.next-cli-build/static/chunks/1321-8460c1d61e66cdd9.js +1 -0
  601. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-ad6c0d386a0a9e15.js → page-ec740b92f0fead18.js} +1 -1
  602. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-00add5a971054c3c.js +1 -0
  603. package/cli/app/.next-cli-build/static/css/{705fa00a1e55feb4.css → 20176eae83d8ef2f.css} +1 -1
  604. package/cli/app/package.json +3 -3
  605. package/cli/package.json +1 -1
  606. package/open-sse/config/appConstants.js +27 -2
  607. package/open-sse/config/providers.js +2 -1
  608. package/open-sse/executors/antigravity.js +39 -8
  609. package/open-sse/services/antigravityHeaderScrub.js +75 -0
  610. package/open-sse/services/antigravityIdentity.js +115 -0
  611. package/open-sse/services/antigravityObfuscation.js +92 -0
  612. package/open-sse/services/usage.js +150 -45
  613. package/package.json +3 -3
  614. package/src/app/(dashboard)/dashboard/profile/page.js +15 -0
  615. package/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.js +3 -3
  616. package/src/app/api/init/route.js +8 -0
  617. package/src/app/api/oauth/antigravity/bulk-import/route.js +2 -0
  618. package/src/app/api/usage/[connectionId]/route.js +22 -170
  619. package/src/app/globals.css +5 -7
  620. package/src/lib/db/index.js +6 -0
  621. package/src/lib/db/repos/quotaCacheRepo.js +80 -0
  622. package/src/lib/db/schema.js +15 -0
  623. package/src/lib/localDb.js +2 -0
  624. package/src/lib/oauth/services/antigravityBulkImportManager.js +1 -1
  625. package/src/lib/usage/quotaRefresh.js +61 -0
  626. package/src/lib/usage/quotaService.js +146 -0
  627. package/src/sse/services/auth.js +45 -1
  628. package/cli/app/.next-cli-build/server/chunks/1051.js +0 -1
  629. package/cli/app/.next-cli-build/server/chunks/1322.js +0 -1
  630. package/cli/app/.next-cli-build/server/chunks/4884.js +0 -13
  631. package/cli/app/.next-cli-build/server/chunks/5723.js +0 -1
  632. package/cli/app/.next-cli-build/server/chunks/6064.js +0 -1
  633. package/cli/app/.next-cli-build/server/chunks/6505.js +0 -1
  634. package/cli/app/.next-cli-build/static/chunks/1321-9e3d0d6db171adb2.js +0 -1
  635. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/page-be4721f0e8d602c8.js +0 -1
  636. /package/cli/app/.next-cli-build/static/{Fz9IMC9Po2I6i0Ou1e39w → AcNhouZGB-IW1HaLcuwFO}/_buildManifest.js +0 -0
  637. /package/cli/app/.next-cli-build/static/{Fz9IMC9Po2I6i0Ou1e39w → AcNhouZGB-IW1HaLcuwFO}/_ssgManifest.js +0 -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"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},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",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"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)"]},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)"]}};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:()=>e});var d=c(76040);async function e(a){let{Database:b}=await Promise.resolve().then(c.t.bind(c,81787,23)),e=new b(a,{create:!0});e.exec(d.oG);let f=new Map;function g(a){let b=f.get(a);return b||(b=e.prepare(a),f.set(a,b)),b}let h=setInterval(()=>{try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);function i(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{f.clear()}catch{}try{e.close()}catch{}}"function"==typeof h.unref&&h.unref();let j=()=>i();return process.once("beforeExit",j),process.once("SIGINT",()=>{j(),process.exit(0)}),process.once("SIGTERM",()=>{j(),process.exit(0)}),{driver:"bun:sqlite",run(a,b=[]){let c=g(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>g(a).get(...b),all:(a,b=[])=>g(a).all(...b),exec:a=>e.exec(a),transaction:a=>e.transaction(a)(),checkpoint(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(h),i()},raw:e}}}};
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"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},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",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"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)"]},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)"]},quotaCache:{columns:{connectionId:"TEXT PRIMARY KEY",provider:"TEXT",data:"TEXT NOT NULL",fetchedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_qc_provider ON quotaCache(provider)"]}};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:()=>e});var d=c(76040);async function e(a){let{Database:b}=await Promise.resolve().then(c.t.bind(c,81787,23)),e=new b(a,{create:!0});e.exec(d.oG);let f=new Map;function g(a){let b=f.get(a);return b||(b=e.prepare(a),f.set(a,b)),b}let h=setInterval(()=>{try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);function i(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{f.clear()}catch{}try{e.close()}catch{}}"function"==typeof h.unref&&h.unref();let j=()=>i();return process.once("beforeExit",j),process.once("SIGINT",()=>{j(),process.exit(0)}),process.once("SIGTERM",()=>{j(),process.exit(0)}),{driver:"bun:sqlite",run(a,b=[]){let c=g(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>g(a).get(...b),all:(a,b=[])=>g(a).all(...b),exec:a=>e.exec(a),transaction:a=>e.transaction(a)(),checkpoint(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(h),i()},raw:e}}}};
@@ -1 +1 @@
1
- "use strict";exports.id=7153,exports.ids=[1998,7153],exports.modules={15626:(a,b,c)=>{c.d(b,{w$:()=>e});let d=c(39006).rE||"0.0.0";function e(a,b={}){let c,f=(c=function(a){if("string"!=typeof a)return"";let b=a.trim();return b?b.startsWith("workos:")?b:`workos:${b}`:""}(a))?`Bearer ${c}`:"",g={"HTTP-Referer":"https://cline.bot","X-Title":"Cline","User-Agent":`9Router/${d}`,"X-PLATFORM":process.platform||"unknown","X-PLATFORM-VERSION":process.version||"unknown","X-CLIENT-TYPE":"9router","X-CLIENT-VERSION":d,"X-CORE-VERSION":d,"X-IS-MULTIROOT":"false",...b};return f&&(g.Authorization=f),g}},30869:(a,b,c)=>{c.d(b,{UY:()=>h,X3:()=>i,eh:()=>f.eh,fg:()=>e.fg,h0:()=>g});var d=c(39006),e=c(75681),f=c(81329);d.rE;let g={npmPackageName:"zevairouter",installCmd:"npm i -g zevairouter",installCmdLatest:"npm i -g zevairouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:1997},h={maxLines:200,pollIntervalMs:1e3},i={openrouter:"https://openrouter.ai/api/v1/chat/completions",glm:"https://api.z.ai/api/anthropic/v1/messages","glm-cn":"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",kimi:"https://api.kimi.com/coding/v1/messages",minimax:"https://api.minimax.io/anthropic/v1/messages","minimax-cn":"https://api.minimaxi.com/anthropic/v1/messages",alicode:"https://coding.dashscope.aliyuncs.com/v1/chat/completions","alicode-intl":"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions","volcengine-ark":"https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",byteplus:"https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",openai:"https://api.openai.com/v1/chat/completions","vercel-ai-gateway":"https://ai-gateway.vercel.sh/v1/chat/completions",anthropic:"https://api.anthropic.com/v1/messages",gemini:"https://generativelanguage.googleapis.com/v1beta/models",ollama:"https://ollama.com/api/chat","ollama-local":"http://localhost:11434/api/chat"}},39006:a=>{a.exports={rE:"1.0.12"}},39326:(a,b,c)=>{c.d(b,{B:()=>f});var d=c(71998);function e(a){return null==a?"":String(a).trim()}async function f(a={}){try{let b=e(a?.proxyPoolId),c="__none__"===b?"":b,f=function(a={}){let b=a?.connectionProxyEnabled===!0,c=e(a?.connectionProxyUrl);return{connectionProxyEnabled:b,connectionProxyUrl:c,connectionNoProxy:e(a?.connectionNoProxy)}}(a);if(c){let a=await (0,d.hr)(c),b=e(a?.proxyUrl),f=e(a?.noProxy);if(a&&!0===a.isActive&&b){if("vercel"===a.type||"cloudflare"===a.type||"deno"===a.type)return{source:a.type,proxyPoolId:c,proxyPool:a,connectionProxyEnabled:!1,connectionProxyUrl:"",connectionNoProxy:f,strictProxy:!0===a.strictProxy,vercelRelayUrl:b};return{source:"pool",proxyPoolId:c,proxyPool:a,connectionProxyEnabled:!0,connectionProxyUrl:b,connectionNoProxy:f,strictProxy:!0===a.strictProxy}}}if(f.connectionProxyEnabled&&f.connectionProxyUrl)return{source:"legacy",proxyPoolId:c||null,proxyPool:null,...f};return{source:"none",proxyPoolId:c||null,proxyPool:null,...f}}catch(a){return console.error("[resolveConnectionProxyConfig] Failed to resolve proxy config:",a),{source:"error",proxyPoolId:null,proxyPool:null,connectionProxyEnabled:!1,connectionProxyUrl:"",connectionNoProxy:"",strictProxy:!1}}}},50122:(a,b,c)=>{c.d(b,{k:()=>e});let d=[];for(let a=0;a<256;++a)d.push((a+256).toString(16).slice(1));function e(a,b=0){return(d[a[b+0]]+d[a[b+1]]+d[a[b+2]]+d[a[b+3]]+"-"+d[a[b+4]]+d[a[b+5]]+"-"+d[a[b+6]]+d[a[b+7]]+"-"+d[a[b+8]]+d[a[b+9]]+"-"+d[a[b+10]]+d[a[b+11]]+d[a[b+12]]+d[a[b+13]]+d[a[b+14]]+d[a[b+15]]).toLowerCase()}},66811:(a,b,c)=>{c.d(b,{F:()=>t});var d=c(89718),e=c(39326),f=c(74926),g=c(75681),h=c(30869),i=c(44404),j=c(35024),k=c(93943),l=c(92990),m=c(15626);let n={claude:{checkExpiry:!0,refreshable:!0},codex:{url:"https://chatgpt.com/backend-api/codex/responses",method:"POST",authHeader:"Authorization",authPrefix:"Bearer ",extraHeaders:{"Content-Type":"application/json",originator:"codex_cli_rs","User-Agent":"codex_cli_rs/0.136.0"},body:JSON.stringify({model:"gpt-5.3-codex",input:[],stream:!1,store:!1}),acceptStatuses:[400],refreshable:!0},"gemini-cli":{url:"https://www.googleapis.com/oauth2/v1/userinfo?alt=json",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",refreshable:!0},antigravity:{url:"https://www.googleapis.com/oauth2/v1/userinfo?alt=json",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",refreshable:!0},github:{url:"https://api.github.com/user",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",extraHeaders:{"User-Agent":"ZevaiRouter",Accept:"application/vnd.github+json"}},iflow:{buildUrl:a=>`https://iflow.cn/api/oauth/getUserInfo?accessToken=${encodeURIComponent(a)}`,method:"GET",noAuth:!0},qwen:{checkExpiry:!0,refreshable:!0},kiro:{checkExpiry:!0,refreshable:!0},qoder:{url:"https://openapi.qoder.sh/api/v1/userinfo",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",refreshable:!1},"kimi-coding":{checkExpiry:!0,refreshable:!1},cursor:{tokenExists:!0},kilocode:{url:`${l.MZ.apiBaseUrl}/api/profile`,method:"GET",authHeader:"Authorization",authPrefix:"Bearer "},cline:{refreshable:!0},gitlab:{url:"https://gitlab.com/api/v4/user",method:"GET",authHeader:"Authorization",authPrefix:"Bearer "},codebuddy:{tokenExists:!0},"codebuddy-cn":{tokenExists:!0}};async function o(a){return await fetch("https://api.cline.bot/api/v1/users/me",{method:"GET",headers:(0,m.w$)(a,{Accept:"application/json"})})}async function p(a){let b=a.provider,c=a.refreshToken;if(!c)return null;try{if("gemini-cli"===b||"antigravity"===b){let a="gemini-cli"===b?l.LT:l.YT,d=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:a.clientId,client_secret:a.clientSecret,grant_type:"refresh_token",refresh_token:c})});if(!d.ok)return null;let e=await d.json();return{accessToken:e.access_token,expiresIn:e.expires_in,refreshToken:e.refresh_token||c}}if("codex"===b)return await (0,k.Vq)(b,a,console);if("claude"===b){let a=await fetch(l.OV.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:c,client_id:l.OV.clientId})});if(!a.ok)return null;let b=await a.json();return{accessToken:b.access_token,expiresIn:b.expires_in,refreshToken:b.refresh_token||c}}if("kiro"===b){let b=a.providerSpecificData||{},d=b.clientId||a.clientId,e=b.clientSecret||a.clientSecret,f=b.region||a.region;if(d&&e){let a=`https://oidc.${f||"us-east-1"}.amazonaws.com/token`,b=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:d,clientSecret:e,refreshToken:c,grantType:"refresh_token"})});if(!b.ok)return null;let g=await b.json();return{accessToken:g.accessToken,expiresIn:g.expiresIn||3600,refreshToken:g.refreshToken||c}}let g=await fetch(l.Tx.socialRefreshUrl,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:c})});if(!g.ok)return null;let h=await g.json();return{accessToken:h.accessToken,expiresIn:h.expiresIn||3600,refreshToken:h.refreshToken||c}}if("qwen"===b){let a=await fetch(l.Hp.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:c,client_id:l.Hp.clientId})});if(!a.ok)return null;let b=await a.json();return{accessToken:b.access_token,expiresIn:b.expires_in,refreshToken:b.refresh_token||c}}if("cline"===b){let a=await fetch(l.lB.refreshUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({refreshToken:c,grantType:"refresh_token",clientType:"extension"})});if(!a.ok)return null;let b=await a.json(),d=b?.data||b,e=d?.expiresAt?Math.max(1,Math.floor((new Date(d.expiresAt).getTime()-Date.now())/1e3)):3600;return{accessToken:d?.accessToken,expiresIn:e,refreshToken:d?.refreshToken||c}}if("codebuddy"===b||"codebuddy-cn"===b){let a="codebuddy-cn"===b?l.ne:l.Nl,d=await fetch(a.refreshUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":a.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":a.domain,"X-Refresh-Token":c,"X-Auth-Refresh-Source":"plugin","X-Product":"SaaS"},body:"{}"});if(!d.ok)return null;let e=await d.json(),f=e?.data||e,g=f?.accessToken||f?.access_token;if(!g)return null;return{accessToken:g,expiresIn:f?.expiresIn||f?.expires_in||86400,refreshToken:f?.refreshToken||f?.refresh_token||c}}return null}catch(a){return console.log(`Error refreshing ${b} token:`,a.message),null}}async function q(a,b=null){let c=n[a.provider];if(!c)return{valid:!1,error:"Provider test not supported",refreshed:!1};if(!a.accessToken)return{valid:!1,error:"No access token",refreshed:!1};if(c.tokenExists)return{valid:!0,error:null,refreshed:!1,newTokens:null};let d=a.accessToken,e=!1,f=null,g=(0,k.fp)(a.provider,a);if(c.refreshable&&g&&a.refreshToken){let b=await p(a);if(!b)return{valid:!1,error:"Token expired and refresh failed",refreshed:!1};d=b.accessToken,e=!0,f=b}if(c.checkExpiry)return e?{valid:!0,error:null,refreshed:e,newTokens:f}:g?{valid:!1,error:"Token expired",refreshed:!1}:{valid:!0,error:null,refreshed:!1,newTokens:null};if("cline"===a.provider){let b=async a=>{let b=await o(a);return b.ok?{valid:!0,error:null,refreshed:e,newTokens:f}:401===b.status?{valid:!1,error:"Token invalid or revoked",refreshed:e}:403===b.status?{valid:!1,error:"Access denied",refreshed:e}:{valid:!1,error:`API returned ${b.status}`,refreshed:e}},c=await b(d);if(c.valid||"Token invalid or revoked"!==c.error||!a.refreshToken)return c;let g=await p(a);return g?.accessToken?(e=!0,f=g,d=g.accessToken,await b(d)):{valid:!1,error:"Token invalid or revoked",refreshed:!1}}try{let g=c.buildUrl?c.buildUrl(d):c.url,h=c.noAuth?{...c.extraHeaders}:{[c.authHeader]:`${c.authPrefix}${d}`,...c.extraHeaders},i={method:c.method,headers:h};c.body&&(i.body=c.body);let j=await r(g,i,b);if(j.ok||c.acceptStatuses&&c.acceptStatuses.includes(j.status))return{valid:!0,error:null,refreshed:e,newTokens:f};if(401===j.status&&c.refreshable&&!e&&a.refreshToken){let d=await p(a);if(d){let a=c.buildUrl?c.buildUrl(d.accessToken):g,e=c.noAuth?{...c.extraHeaders}:{[c.authHeader]:`${c.authPrefix}${d.accessToken}`,...c.extraHeaders},f={method:c.method,headers:e};c.body&&(f.body=c.body);let h=await r(a,f,b);if(h.ok||c.acceptStatuses&&c.acceptStatuses.includes(h.status))return{valid:!0,error:null,refreshed:!0,newTokens:d}}return{valid:!1,error:"Token invalid or revoked",refreshed:!1}}if(401===j.status)return{valid:!1,error:"Token invalid or revoked",refreshed:e};if(403===j.status)return{valid:!1,error:"Access denied",refreshed:e};return{valid:!1,error:`API returned ${j.status}`,refreshed:e}}catch(a){return{valid:!1,error:a.message,refreshed:e}}}async function r(a,b={},d=null){if(d?.vercelRelayUrl){let{proxyAwareFetch:e}=await Promise.resolve().then(c.bind(c,39609));return e(a,b,{vercelRelayUrl:d.vercelRelayUrl})}if(!d?.connectionProxyEnabled||!d?.connectionProxyUrl)return fetch(a,b);let{proxyAwareFetch:e}=await Promise.resolve().then(c.bind(c,39609));return e(a,b,{connectionProxyEnabled:!0,connectionProxyUrl:d.connectionProxyUrl,connectionNoProxy:d.connectionNoProxy||""})}async function s(a,b=null){if((0,g.mq)(a.provider)){let c=a.providerSpecificData?.baseUrl;if(!c)return{valid:!1,error:"Missing base URL"};try{let d=await r(`${c.replace(/\/$/,"")}/models`,{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:d.ok,error:d.ok?null:"Invalid API key or base URL"}}catch(a){return{valid:!1,error:a.message}}}if((0,g.gb)(a.provider)){let c=a.providerSpecificData?.baseUrl;if(!c)return{valid:!1,error:"Missing base URL"};try{(c=c.replace(/\/$/,"")).endsWith("/messages")&&(c=c.slice(0,-9));let d=await r(`${c}/models`,{headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01",Authorization:`Bearer ${a.apiKey}`}},b);return{valid:d.ok,error:d.ok?null:"Invalid API key or base URL"}}catch(a){return{valid:!1,error:a.message}}}try{switch(a.provider){case"cloudflare-ai":{let c=(a.providerSpecificData||{}).accountId;if(!c)return{valid:!1,error:"Missing Account ID"};let d=`https://api.cloudflare.com/client/v4/accounts/${c}/ai/v1/chat/completions`,e=await r(d,{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({model:(0,i.fZ)("cloudflare-ai"),messages:[{role:"user",content:"test"}],max_tokens:1})},b),f=401!==e.status&&403!==e.status&&404!==e.status;return{valid:f,error:f?null:"Invalid API token or Account ID"}}case"azure":{let c=a.providerSpecificData||{},d=(c.azureEndpoint||"").replace(/\/$/,""),e=c.deployment||"gpt-4",f=c.apiVersion||"2024-10-01-preview",g=`${d}/openai/deployments/${e}/chat/completions?api-version=${f}`,h={"api-key":a.apiKey,"Content-Type":"application/json"};c.organization&&(h["OpenAI-Organization"]=c.organization);let i=await r(g,{method:"POST",headers:h,body:JSON.stringify({messages:[{role:"user",content:"test"}],max_completion_tokens:1})},b),j=401!==i.status&&403!==i.status;return{valid:j,error:j?null:"Invalid API key or Azure configuration"}}case"openai":{let c=await r("https://api.openai.com/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"vercel-ai-gateway":{let c=await r("https://ai-gateway.vercel.sh/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"anthropic":{let c=await r("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"claude-3-haiku-20240307",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"gemini":{let c=await r(`https://generativelanguage.googleapis.com/v1/models?key=${a.apiKey}`,{},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"openrouter":{let c=await r("https://openrouter.ai/api/v1/auth/key",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"glm":{let c=await r("https://api.z.ai/api/anthropic/v1/messages",{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"glm-4.7",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"glm-cn":{let c=await r("https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"content-type":"application/json"},body:JSON.stringify({model:"glm-4.7",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"minimax":case"minimax-cn":{let c=await r({minimax:"https://api.minimax.io/anthropic/v1/messages","minimax-cn":"https://api.minimaxi.com/anthropic/v1/messages"}[a.provider],{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"minimax-m2",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"kimi":{let c=await r("https://api.kimi.com/coding/v1/messages",{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"kimi-latest",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"alicode":case"alicode-intl":{let c="alicode-intl"===a.provider?"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions":"https://coding.dashscope.aliyuncs.com/v1/chat/completions",d=await r(c,{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"content-type":"application/json"},body:JSON.stringify({model:(0,i.fZ)(a.provider),max_tokens:1,messages:[{role:"user",content:"test"}]})},b),e=401!==d.status&&403!==d.status;return{valid:e,error:e?null:"Invalid API key"}}case"volcengine-ark":case"byteplus":{let c=await r(h.X3[a.provider],{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"content-type":"application/json"},body:JSON.stringify({model:(0,i.fZ)(a.provider),max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"deepseek":{let c=await r("https://api.deepseek.com/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"groq":{let c=await r("https://api.groq.com/openai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"mistral":{let c=await r("https://api.mistral.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"xai":{let c=await r("https://api.x.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"nvidia":{let c=await r("https://integrate.api.nvidia.com/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"perplexity":{let c=await r("https://api.perplexity.ai/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"together":{let c=await r("https://api.together.xyz/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"fireworks":{let c=await r("https://api.fireworks.ai/inference/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"cerebras":{let c=await r("https://api.cerebras.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"cohere":{let c=await r("https://api.cohere.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"nebius":{let c=await r("https://api.studio.nebius.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"siliconflow":{let c=await r("https://api.siliconflow.cn/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"hyperbolic":{let c=await r("https://api.hyperbolic.xyz/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"ollama":{let b=await fetch("https://ollama.com/api/tags",{headers:{Authorization:`Bearer ${a.apiKey}`}});return{valid:b.ok,error:b.ok?null:"Invalid API key"}}case"ollama-local":{let b=(0,j.Ak)(a),c=await fetch(`${b}/api/tags`);return{valid:c.ok,error:c.ok?null:`Ollama not reachable at ${b}`}}case"deepgram":{let c=await r("https://api.deepgram.com/v1/projects",{headers:{Authorization:`Token ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"assemblyai":{let c=await r("https://api.assemblyai.com/v1/account",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"nanobanana":{let c=await r("https://api.nanobananaapi.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"fal-ai":{let c=await r("https://api.fal.ai/v1/models?limit=1",{headers:{Authorization:`Key ${a.apiKey}`}},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"chutes":{let c=await r("https://llm.chutes.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"grok-web":{let c=a.apiKey.startsWith("sso=")?a.apiKey.slice(4):a.apiKey,d=a=>Array.from(crypto.getRandomValues(new Uint8Array(a)),a=>a.toString(16).padStart(2,"0")).join(""),e=Buffer.from("e:TypeError: Cannot read properties of null (reading 'children')").toString("base64"),f=await r("https://grok.com/rest/app-chat/conversations/new",{method:"POST",headers:{Accept:"*/*","Content-Type":"application/json",Cookie:`sso=${c}`,Origin:"https://grok.com",Referer:"https://grok.com/","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36","x-statsig-id":e,"x-xai-request-id":crypto.randomUUID(),traceparent:`00-${d(16)}-${d(8)}-00`},body:JSON.stringify({temporary:!0,modelName:"grok-4",message:"ping",fileAttachments:[],imageAttachments:[],disableSearch:!1,enableImageGeneration:!1,sendFinalMetadata:!0})},b),g=401!==f.status&&403!==f.status;return{valid:g,error:g?null:"Invalid SSO cookie"}}case"perplexity-web":{let c=a.apiKey;c.startsWith("__Secure-next-auth.session-token=")&&(c=c.slice(33));let d=await r("https://www.perplexity.ai/api/auth/session",{method:"GET",headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",Cookie:`__Secure-next-auth.session-token=${c}`}},b);if(!d.ok)return{valid:!1,error:"Invalid session cookie"};let e=await d.json().catch(()=>null),f=!!(e&&e.user);return{valid:f,error:f?null:"Session expired — re-paste cookie"}}case"opencode-go":{let c=await r("https://opencode.ai/zen/go/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a.apiKey}`},body:JSON.stringify({model:(0,i.fZ)("opencode-go"),messages:[{role:"user",content:"ping"}],max_tokens:1,stream:!1})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"xiaomi-mimo":case"xiaomi-tokenplan":{let c=await r(`${{"xiaomi-mimo":"https://api.xiaomimimo.com/v1","xiaomi-tokenplan":"https://token-plan-sgp.xiaomimimo.com/v1"}[a.provider]}/models`,{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"codebuddy":case"codebuddy-cn":{let c="codebuddy-cn"===a.provider?l.ne:l.Nl,d=c.baseUrl,e=await r(`${d}/v2/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":c.userAgent,"X-Domain":c.domain,"X-Requested-With":"XMLHttpRequest","X-Product":"SaaS","X-Api-Key":a.apiKey},body:JSON.stringify({model:"default-model-lite",max_tokens:1,messages:[{role:"user",content:"hi"}]})},b),f=e.ok||429===e.status||400===e.status;return{valid:f,error:f?null:`Invalid API key (${e.status})`}}default:return{valid:!1,error:"Provider test not supported"}}}catch(a){return{valid:!1,error:a.message}}}async function t(a){let b,c=await (0,d.Mc)(a);if(!c)return{valid:!1,error:"Connection not found",latencyMs:0,testedAt:new Date().toISOString()};let g=await (0,e.B)(c.providerSpecificData||{});if(g.connectionProxyEnabled&&g.connectionProxyUrl&&!g.vercelRelayUrl){let b=await (0,f.C)({proxyUrl:g.connectionProxyUrl});if(!b.ok){let c=b.error||`Proxy test failed with status ${b.status}`;return await (0,d.updateProviderConnection)(a,{testStatus:"error",lastError:c,lastErrorAt:new Date().toISOString()}),{valid:!1,error:c,latencyMs:0,testedAt:new Date().toISOString()}}}let h=Date.now();b="apikey"===c.authType||"cookie"===c.authType?await s(c,g):await q(c,g);let i=Date.now()-h,j={testStatus:b.valid?"active":"error",lastError:b.valid?null:b.error,lastErrorAt:b.valid?null:new Date().toISOString()};return b.refreshed&&b.newTokens&&(b.newTokens.accessToken&&(j.accessToken=b.newTokens.accessToken),b.newTokens.refreshToken&&(j.refreshToken=b.newTokens.refreshToken),b.newTokens.idToken&&(j.idToken=b.newTokens.idToken),b.newTokens.lastRefreshAt&&(j.lastRefreshAt=b.newTokens.lastRefreshAt),b.newTokens.expiresIn&&(j.expiresIn=b.newTokens.expiresIn),b.newTokens.expiresIn?j.expiresAt=new Date(Date.now()+1e3*b.newTokens.expiresIn).toISOString():b.newTokens.expiresAt&&(j.expiresAt=b.newTokens.expiresAt),b.newTokens.providerSpecificData&&(j.providerSpecificData={...c.providerSpecificData||{},...b.newTokens.providerSpecificData})),await (0,d.updateProviderConnection)(a,j),{valid:b.valid,error:b.error,refreshed:!!b.refreshed,latencyMs:i,testedAt:new Date().toISOString()}}},71998:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.getProviderConnections,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(89718)},74926:(a,b,c)=>{c.d(b,{C:()=>f});var d=c(47774);function e(a){return null==a?"":String(a).trim()}async function f({proxyUrl:a,testUrl:b,timeoutMs:c}={}){let g,h=e(a);if(!h)return{ok:!1,status:400,error:"proxyUrl is required"};let i=e(b)||"https://google.com/",j=Number(c),k=Number.isFinite(j)&&j>0?Math.min(j,3e4):8e3;try{try{g=new d.ProxyAgent({uri:h})}catch(a){return{ok:!1,status:400,error:`Invalid proxy URL: ${a?.message||String(a)}`}}let a=new AbortController,b=Date.now(),c=setTimeout(()=>a.abort(),k);try{let c=await (0,d.hd)(i,{method:"HEAD",dispatcher:g,signal:a.signal,headers:{"User-Agent":"9Router"}});return{ok:c.ok,status:c.status,statusText:c.statusText,url:i,elapsedMs:Date.now()-b}}catch(b){let a=b?.name==="AbortError"?"Proxy test timed out":function(a){if(!a)return"Unknown error";let b=a?.message||String(a),c=a?.cause?.code||a?.code,d=a?.cause?.message;return d&&d!==b?c?`${b}: ${d} (${c})`:`${b}: ${d}`:c&&!b.includes(c)?`${b} (${c})`:b}(b);return{ok:!1,status:500,error:a}}finally{clearTimeout(c)}}finally{try{await g?.close?.()}catch{}}}},89718:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(9248)},92990:(a,b,c)=>{c.d(b,{DI:()=>g,Hp:()=>i,LT:()=>h,MZ:()=>r,Nl:()=>u,Nu:()=>n,OV:()=>f,Tx:()=>o,WN:()=>p,Ww:()=>w,YT:()=>l,ZL:()=>k,cD:()=>m,f7:()=>t,hF:()=>j,lB:()=>s,ne:()=>v,t:()=>q});var d=c(21820);function e(){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 f={clientId:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",authorizeUrl:"https://claude.ai/oauth/authorize",tokenUrl:"https://api.anthropic.com/v1/oauth/token",scopes:["org:create_api_key","user:profile","user:inference"],codeChallengeMethod:"S256"},g={clientId:"app_EMoamEEZ73f0CkXaXp7hrann",authorizeUrl:"https://auth.openai.com/oauth/authorize",tokenUrl:"https://auth.openai.com/oauth/token",scope:"openid profile email offline_access",codeChallengeMethod:"S256",extraParams:{id_token_add_organizations:"true",codex_cli_simplified_flow:"true",originator:"codex_cli_rs"}},h={clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",userInfoUrl:"https://www.googleapis.com/oauth2/v1/userinfo",scopes:["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/userinfo.profile"]},i={clientId:"f0304373b74a44d2b584a3fb70ca9e56",deviceCodeUrl:"https://chat.qwen.ai/api/v1/oauth2/device/code",tokenUrl:"https://chat.qwen.ai/api/v1/oauth2/token",scope:"openid profile email model.completion",codeChallengeMethod:"S256"},j={openApiBaseUrl:"https://openapi.qoder.sh",centerBaseUrl:"https://center.qoder.sh",chatBaseUrl:"https://api3.qoder.sh",deviceTokenUrl:"https://openapi.qoder.sh/api/v1/deviceToken/poll",refreshUrl:"https://center.qoder.sh/algo/api/v3/user/refresh_token",userInfoUrl:"https://openapi.qoder.sh/api/v1/userinfo",quotaUsageUrl:"https://openapi.qoder.sh/api/v2/quota/usage",loginUrl:"https://qoder.com/device/selectAccounts"},k={clientId:"10009311001",clientSecret:"4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",authorizeUrl:"https://iflow.cn/oauth",tokenUrl:"https://iflow.cn/oauth/token",userInfoUrl:"https://iflow.cn/api/oauth/getUserInfo",extraParams:{loginMethod:"phone",type:"phone"}},l={clientId:"1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",clientSecret:"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",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",userInfoUrl:"https://www.googleapis.com/oauth2/v1/userinfo",scopes:["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/cclog","https://www.googleapis.com/auth/experimentsandconfigs"],apiEndpoint:"https://cloudcode-pa.googleapis.com",apiVersion:"v1internal",loadCodeAssistEndpoint:"https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",onboardUserEndpoint:"https://cloudcode-pa.googleapis.com/v1internal:onboardUser",loadCodeAssistUserAgent:"google-api-nodejs-client/9.15.1",loadCodeAssistApiClient:"google-cloud-sdk vscode_cloudshelleditor/0.1",loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:e(),pluginType:2})};function m(){return{ideType:9,platform:e(),pluginType:2}}let n={clientId:"Iv1.b507a08c87ecfe98",deviceCodeUrl:"https://github.com/login/device/code",tokenUrl:"https://github.com/login/oauth/access_token",userInfoUrl:"https://api.github.com/user",scopes:"read:user",apiVersion:"2022-11-28",copilotTokenUrl:"https://api.github.com/copilot_internal/v2/token",userAgent:"GitHubCopilotChat/0.26.7",editorVersion:"vscode/1.85.0",editorPluginVersion:"copilot-chat/0.26.7"},o={ssoOidcEndpoint:"https://oidc.us-east-1.amazonaws.com",registerClientUrl:"https://oidc.us-east-1.amazonaws.com/client/register",deviceAuthUrl:"https://oidc.us-east-1.amazonaws.com/device_authorization",tokenUrl:"https://oidc.us-east-1.amazonaws.com/token",startUrl:"https://view.awsapps.com/start",clientName:"kiro-oauth-client",clientType:"public",scopes:["codewhisperer:completions","codewhisperer:analysis","codewhisperer:conversations"],grantTypes:["urn:ietf:params:oauth:grant-type:device_code","refresh_token"],issuerUrl:"https://identitycenter.amazonaws.com/ssoins-722374e8c3c8e6c6",socialAuthEndpoint:"https://prod.us-east-1.auth.desktop.kiro.dev",socialLoginUrl:"https://prod.us-east-1.auth.desktop.kiro.dev/login",socialTokenUrl:"https://prod.us-east-1.auth.desktop.kiro.dev/oauth/token",socialRefreshUrl:"https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",authMethods:["builder-id","idc","google","github","import"]},p={apiEndpoint:"https://api2.cursor.sh",chatEndpoint:"/aiserver.v1.ChatService/StreamUnifiedChatWithTools",modelsEndpoint:"/aiserver.v1.AiService/GetDefaultModelNudgeData",api3Endpoint:"https://api3.cursor.sh",agentEndpoint:"https://agent.api5.cursor.sh",agentNonPrivacyEndpoint:"https://agentn.api5.cursor.sh",clientVersion:"3.1.0",clientType:"ide",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"},dbKeys:{accessToken:"cursorAuth/accessToken",machineId:"storage.serviceMachineId"}},q={clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||"17e5f671-d194-4dfb-9706-5516cb48c098",deviceCodeUrl:"https://auth.kimi.com/api/oauth/device_authorization",tokenUrl:"https://auth.kimi.com/api/oauth/token"},r={apiBaseUrl:"https://api.kilo.ai",initiateUrl:"https://api.kilo.ai/api/device-auth/codes",pollUrlBase:"https://api.kilo.ai/api/device-auth/codes"},s={appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",authorizeUrl:"https://api.cline.bot/api/v1/auth/authorize",tokenExchangeUrl:"https://api.cline.bot/api/v1/auth/token",refreshUrl:"https://api.cline.bot/api/v1/auth/refresh"},t={defaultBaseUrl:"https://gitlab.com",authorizeUrlPath:"/oauth/authorize",tokenUrlPath:"/oauth/token",userInfoUrlPath:"/api/v4/user",scope:"api read_user",codeChallengeMethod:"S256"},u={baseUrl:"https://www.codebuddy.ai",stateUrl:"https://www.codebuddy.ai/v2/plugin/auth/state",tokenUrl:"https://www.codebuddy.ai/v2/plugin/auth/token",accountUrl:"https://www.codebuddy.ai/v2/plugin/login/account",accountsUrl:"https://www.codebuddy.ai/v2/plugin/accounts",refreshUrl:"https://www.codebuddy.ai/v2/plugin/auth/token/refresh",userAgent:"CLI/2.63.2 CodeBuddy/2.63.2",domain:"www.codebuddy.ai",platform:"CLI",pollInterval:5e3},v={baseUrl:"https://www.codebuddy.cn",stateUrl:"https://www.codebuddy.cn/v2/plugin/auth/state",tokenUrl:"https://www.codebuddy.cn/v2/plugin/auth/token",accountUrl:"https://www.codebuddy.cn/v2/plugin/login/account",accountsUrl:"https://www.codebuddy.cn/v2/plugin/accounts",refreshUrl:"https://www.codebuddy.cn/v2/plugin/auth/token/refresh",userAgent:"CLI/2.63.2 CodeBuddy/2.63.2",domain:"www.codebuddy.cn",platform:"CLI",pollInterval:5e3},w=3e5},93943:(a,b,c)=>{c.d(b,{Vq:()=>i,fp:()=>g});var d=c(8590);let e=new Map;function f(a){if(null==a||""===a)return null;if("number"==typeof a)return a<1e12?1e3*a:a;let b=new Date(a).getTime();return Number.isFinite(b)?b:null}function g(a,b,c=Date.now()){if(!b)return!1;let e=f(b?.expiresAt??b?.tokenExpiresAt);return!!(null!==e&&e-c<(0,d.Og)(a)||"codex"===a&&b.refreshToken&&function(a,b=Date.now()){let c=f(a?.lastRefreshAt??a?.lastRefresh??a?.providerSpecificData?.lastRefreshAt);return!c||b-c>=6912e5}(b,c))}async function h(a,b,c){let d,f=(d=b?.connectionId||b?.id||b?.email||b?.name||b?.refreshToken?.slice?.(-16)||"default",`${a}:${d}`),g=e.get(f);if(g)return g;let h=Promise.resolve().then(c).finally(()=>{e.delete(f)});return e.set(f,h),h}async function i(a,b,c){return b?h(a,b,async()=>{let e=await (0,d.$B)(a,b,c);return function(a,b,c,e=Date.now()){var f,g;if(!c)return null;if((0,d.jT)(c))return c;let h={},i=new Date(e).toISOString();c.accessToken&&(h.accessToken=c.accessToken),c.apiKey&&(h.apiKey=c.apiKey),c.token&&(h.token=c.token);let j=c.refreshToken??b?.refreshToken;j&&(h.refreshToken=j);let k=c.idToken??b?.idToken;return k&&(h.idToken=k),c.expiresIn?(h.expiresIn=c.expiresIn,h.expiresAt=function(a,b=Date.now()){return a?new Date(b+1e3*a).toISOString():null}(c.expiresIn,e)):c.expiresAt&&(h.expiresAt=c.expiresAt),c.projectId&&(h.projectId=c.projectId),c.providerSpecificData&&(f=b?.providerSpecificData,h.providerSpecificData=(g=c.providerSpecificData)&&"object"==typeof g?{...f||{},...g}:f),c.copilotToken&&(h.copilotToken=c.copilotToken),c.copilotTokenExpiresAt&&(h.copilotTokenExpiresAt=c.copilotTokenExpiresAt),("codex"===a||h.accessToken||h.apiKey||h.token||h.refreshToken||h.copilotToken)&&(h.lastRefreshAt=c.lastRefreshAt||i),h}(a,b,e)}):null}},94755:(a,b,c)=>{c.d(b,{A:()=>i});var d=c(77598);let e={randomUUID:d.randomUUID},f=new Uint8Array(256),g=f.length;var h=c(50122);let i=function(a,b,c){if(e.randomUUID&&!b&&!a)return e.randomUUID();var i=a,j=c;let k=(i=i||{}).random??i.rng?.()??(g>f.length-16&&((0,d.randomFillSync)(f),g=0),f.slice(g,g+=16));if(k.length<16)throw Error("Random bytes length must be >= 16");if(k[6]=15&k[6]|64,k[8]=63&k[8]|128,b){if((j=j||0)<0||j+16>b.length)throw RangeError(`UUID byte range ${j}:${j+15} is out of buffer bounds`);for(let a=0;a<16;++a)b[j+a]=k[a];return b}return(0,h.k)(k)}}};
1
+ "use strict";exports.id=7153,exports.ids=[1998,7153],exports.modules={15626:(a,b,c)=>{c.d(b,{w$:()=>e});let d=c(39006).rE||"0.0.0";function e(a,b={}){let c,f=(c=function(a){if("string"!=typeof a)return"";let b=a.trim();return b?b.startsWith("workos:")?b:`workos:${b}`:""}(a))?`Bearer ${c}`:"",g={"HTTP-Referer":"https://cline.bot","X-Title":"Cline","User-Agent":`9Router/${d}`,"X-PLATFORM":process.platform||"unknown","X-PLATFORM-VERSION":process.version||"unknown","X-CLIENT-TYPE":"9router","X-CLIENT-VERSION":d,"X-CORE-VERSION":d,"X-IS-MULTIROOT":"false",...b};return f&&(g.Authorization=f),g}},30869:(a,b,c)=>{c.d(b,{UY:()=>h,X3:()=>i,eh:()=>f.eh,fg:()=>e.fg,h0:()=>g});var d=c(39006),e=c(75681),f=c(81329);d.rE;let g={npmPackageName:"zevairouter",installCmd:"npm i -g zevairouter",installCmdLatest:"npm i -g zevairouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:1997},h={maxLines:200,pollIntervalMs:1e3},i={openrouter:"https://openrouter.ai/api/v1/chat/completions",glm:"https://api.z.ai/api/anthropic/v1/messages","glm-cn":"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",kimi:"https://api.kimi.com/coding/v1/messages",minimax:"https://api.minimax.io/anthropic/v1/messages","minimax-cn":"https://api.minimaxi.com/anthropic/v1/messages",alicode:"https://coding.dashscope.aliyuncs.com/v1/chat/completions","alicode-intl":"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions","volcengine-ark":"https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",byteplus:"https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",openai:"https://api.openai.com/v1/chat/completions","vercel-ai-gateway":"https://ai-gateway.vercel.sh/v1/chat/completions",anthropic:"https://api.anthropic.com/v1/messages",gemini:"https://generativelanguage.googleapis.com/v1beta/models",ollama:"https://ollama.com/api/chat","ollama-local":"http://localhost:11434/api/chat"}},39006:a=>{a.exports={rE:"1.0.14"}},39326:(a,b,c)=>{c.d(b,{B:()=>f});var d=c(71998);function e(a){return null==a?"":String(a).trim()}async function f(a={}){try{let b=e(a?.proxyPoolId),c="__none__"===b?"":b,f=function(a={}){let b=a?.connectionProxyEnabled===!0,c=e(a?.connectionProxyUrl);return{connectionProxyEnabled:b,connectionProxyUrl:c,connectionNoProxy:e(a?.connectionNoProxy)}}(a);if(c){let a=await (0,d.hr)(c),b=e(a?.proxyUrl),f=e(a?.noProxy);if(a&&!0===a.isActive&&b){if("vercel"===a.type||"cloudflare"===a.type||"deno"===a.type)return{source:a.type,proxyPoolId:c,proxyPool:a,connectionProxyEnabled:!1,connectionProxyUrl:"",connectionNoProxy:f,strictProxy:!0===a.strictProxy,vercelRelayUrl:b};return{source:"pool",proxyPoolId:c,proxyPool:a,connectionProxyEnabled:!0,connectionProxyUrl:b,connectionNoProxy:f,strictProxy:!0===a.strictProxy}}}if(f.connectionProxyEnabled&&f.connectionProxyUrl)return{source:"legacy",proxyPoolId:c||null,proxyPool:null,...f};return{source:"none",proxyPoolId:c||null,proxyPool:null,...f}}catch(a){return console.error("[resolveConnectionProxyConfig] Failed to resolve proxy config:",a),{source:"error",proxyPoolId:null,proxyPool:null,connectionProxyEnabled:!1,connectionProxyUrl:"",connectionNoProxy:"",strictProxy:!1}}}},50122:(a,b,c)=>{c.d(b,{k:()=>e});let d=[];for(let a=0;a<256;++a)d.push((a+256).toString(16).slice(1));function e(a,b=0){return(d[a[b+0]]+d[a[b+1]]+d[a[b+2]]+d[a[b+3]]+"-"+d[a[b+4]]+d[a[b+5]]+"-"+d[a[b+6]]+d[a[b+7]]+"-"+d[a[b+8]]+d[a[b+9]]+"-"+d[a[b+10]]+d[a[b+11]]+d[a[b+12]]+d[a[b+13]]+d[a[b+14]]+d[a[b+15]]).toLowerCase()}},66811:(a,b,c)=>{c.d(b,{F:()=>t});var d=c(89718),e=c(39326),f=c(74926),g=c(75681),h=c(30869),i=c(44404),j=c(35024),k=c(93943),l=c(92990),m=c(15626);let n={claude:{checkExpiry:!0,refreshable:!0},codex:{url:"https://chatgpt.com/backend-api/codex/responses",method:"POST",authHeader:"Authorization",authPrefix:"Bearer ",extraHeaders:{"Content-Type":"application/json",originator:"codex_cli_rs","User-Agent":"codex_cli_rs/0.136.0"},body:JSON.stringify({model:"gpt-5.3-codex",input:[],stream:!1,store:!1}),acceptStatuses:[400],refreshable:!0},"gemini-cli":{url:"https://www.googleapis.com/oauth2/v1/userinfo?alt=json",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",refreshable:!0},antigravity:{url:"https://www.googleapis.com/oauth2/v1/userinfo?alt=json",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",refreshable:!0},github:{url:"https://api.github.com/user",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",extraHeaders:{"User-Agent":"ZevaiRouter",Accept:"application/vnd.github+json"}},iflow:{buildUrl:a=>`https://iflow.cn/api/oauth/getUserInfo?accessToken=${encodeURIComponent(a)}`,method:"GET",noAuth:!0},qwen:{checkExpiry:!0,refreshable:!0},kiro:{checkExpiry:!0,refreshable:!0},qoder:{url:"https://openapi.qoder.sh/api/v1/userinfo",method:"GET",authHeader:"Authorization",authPrefix:"Bearer ",refreshable:!1},"kimi-coding":{checkExpiry:!0,refreshable:!1},cursor:{tokenExists:!0},kilocode:{url:`${l.MZ.apiBaseUrl}/api/profile`,method:"GET",authHeader:"Authorization",authPrefix:"Bearer "},cline:{refreshable:!0},gitlab:{url:"https://gitlab.com/api/v4/user",method:"GET",authHeader:"Authorization",authPrefix:"Bearer "},codebuddy:{tokenExists:!0},"codebuddy-cn":{tokenExists:!0}};async function o(a){return await fetch("https://api.cline.bot/api/v1/users/me",{method:"GET",headers:(0,m.w$)(a,{Accept:"application/json"})})}async function p(a){let b=a.provider,c=a.refreshToken;if(!c)return null;try{if("gemini-cli"===b||"antigravity"===b){let a="gemini-cli"===b?l.LT:l.YT,d=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:a.clientId,client_secret:a.clientSecret,grant_type:"refresh_token",refresh_token:c})});if(!d.ok)return null;let e=await d.json();return{accessToken:e.access_token,expiresIn:e.expires_in,refreshToken:e.refresh_token||c}}if("codex"===b)return await (0,k.Vq)(b,a,console);if("claude"===b){let a=await fetch(l.OV.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:c,client_id:l.OV.clientId})});if(!a.ok)return null;let b=await a.json();return{accessToken:b.access_token,expiresIn:b.expires_in,refreshToken:b.refresh_token||c}}if("kiro"===b){let b=a.providerSpecificData||{},d=b.clientId||a.clientId,e=b.clientSecret||a.clientSecret,f=b.region||a.region;if(d&&e){let a=`https://oidc.${f||"us-east-1"}.amazonaws.com/token`,b=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:d,clientSecret:e,refreshToken:c,grantType:"refresh_token"})});if(!b.ok)return null;let g=await b.json();return{accessToken:g.accessToken,expiresIn:g.expiresIn||3600,refreshToken:g.refreshToken||c}}let g=await fetch(l.Tx.socialRefreshUrl,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:c})});if(!g.ok)return null;let h=await g.json();return{accessToken:h.accessToken,expiresIn:h.expiresIn||3600,refreshToken:h.refreshToken||c}}if("qwen"===b){let a=await fetch(l.Hp.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:c,client_id:l.Hp.clientId})});if(!a.ok)return null;let b=await a.json();return{accessToken:b.access_token,expiresIn:b.expires_in,refreshToken:b.refresh_token||c}}if("cline"===b){let a=await fetch(l.lB.refreshUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({refreshToken:c,grantType:"refresh_token",clientType:"extension"})});if(!a.ok)return null;let b=await a.json(),d=b?.data||b,e=d?.expiresAt?Math.max(1,Math.floor((new Date(d.expiresAt).getTime()-Date.now())/1e3)):3600;return{accessToken:d?.accessToken,expiresIn:e,refreshToken:d?.refreshToken||c}}if("codebuddy"===b||"codebuddy-cn"===b){let a="codebuddy-cn"===b?l.ne:l.Nl,d=await fetch(a.refreshUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":a.userAgent,"X-Requested-With":"XMLHttpRequest","X-Domain":a.domain,"X-Refresh-Token":c,"X-Auth-Refresh-Source":"plugin","X-Product":"SaaS"},body:"{}"});if(!d.ok)return null;let e=await d.json(),f=e?.data||e,g=f?.accessToken||f?.access_token;if(!g)return null;return{accessToken:g,expiresIn:f?.expiresIn||f?.expires_in||86400,refreshToken:f?.refreshToken||f?.refresh_token||c}}return null}catch(a){return console.log(`Error refreshing ${b} token:`,a.message),null}}async function q(a,b=null){let c=n[a.provider];if(!c)return{valid:!1,error:"Provider test not supported",refreshed:!1};if(!a.accessToken)return{valid:!1,error:"No access token",refreshed:!1};if(c.tokenExists)return{valid:!0,error:null,refreshed:!1,newTokens:null};let d=a.accessToken,e=!1,f=null,g=(0,k.fp)(a.provider,a);if(c.refreshable&&g&&a.refreshToken){let b=await p(a);if(!b)return{valid:!1,error:"Token expired and refresh failed",refreshed:!1};d=b.accessToken,e=!0,f=b}if(c.checkExpiry)return e?{valid:!0,error:null,refreshed:e,newTokens:f}:g?{valid:!1,error:"Token expired",refreshed:!1}:{valid:!0,error:null,refreshed:!1,newTokens:null};if("cline"===a.provider){let b=async a=>{let b=await o(a);return b.ok?{valid:!0,error:null,refreshed:e,newTokens:f}:401===b.status?{valid:!1,error:"Token invalid or revoked",refreshed:e}:403===b.status?{valid:!1,error:"Access denied",refreshed:e}:{valid:!1,error:`API returned ${b.status}`,refreshed:e}},c=await b(d);if(c.valid||"Token invalid or revoked"!==c.error||!a.refreshToken)return c;let g=await p(a);return g?.accessToken?(e=!0,f=g,d=g.accessToken,await b(d)):{valid:!1,error:"Token invalid or revoked",refreshed:!1}}try{let g=c.buildUrl?c.buildUrl(d):c.url,h=c.noAuth?{...c.extraHeaders}:{[c.authHeader]:`${c.authPrefix}${d}`,...c.extraHeaders},i={method:c.method,headers:h};c.body&&(i.body=c.body);let j=await r(g,i,b);if(j.ok||c.acceptStatuses&&c.acceptStatuses.includes(j.status))return{valid:!0,error:null,refreshed:e,newTokens:f};if(401===j.status&&c.refreshable&&!e&&a.refreshToken){let d=await p(a);if(d){let a=c.buildUrl?c.buildUrl(d.accessToken):g,e=c.noAuth?{...c.extraHeaders}:{[c.authHeader]:`${c.authPrefix}${d.accessToken}`,...c.extraHeaders},f={method:c.method,headers:e};c.body&&(f.body=c.body);let h=await r(a,f,b);if(h.ok||c.acceptStatuses&&c.acceptStatuses.includes(h.status))return{valid:!0,error:null,refreshed:!0,newTokens:d}}return{valid:!1,error:"Token invalid or revoked",refreshed:!1}}if(401===j.status)return{valid:!1,error:"Token invalid or revoked",refreshed:e};if(403===j.status)return{valid:!1,error:"Access denied",refreshed:e};return{valid:!1,error:`API returned ${j.status}`,refreshed:e}}catch(a){return{valid:!1,error:a.message,refreshed:e}}}async function r(a,b={},d=null){if(d?.vercelRelayUrl){let{proxyAwareFetch:e}=await Promise.resolve().then(c.bind(c,39609));return e(a,b,{vercelRelayUrl:d.vercelRelayUrl})}if(!d?.connectionProxyEnabled||!d?.connectionProxyUrl)return fetch(a,b);let{proxyAwareFetch:e}=await Promise.resolve().then(c.bind(c,39609));return e(a,b,{connectionProxyEnabled:!0,connectionProxyUrl:d.connectionProxyUrl,connectionNoProxy:d.connectionNoProxy||""})}async function s(a,b=null){if((0,g.mq)(a.provider)){let c=a.providerSpecificData?.baseUrl;if(!c)return{valid:!1,error:"Missing base URL"};try{let d=await r(`${c.replace(/\/$/,"")}/models`,{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:d.ok,error:d.ok?null:"Invalid API key or base URL"}}catch(a){return{valid:!1,error:a.message}}}if((0,g.gb)(a.provider)){let c=a.providerSpecificData?.baseUrl;if(!c)return{valid:!1,error:"Missing base URL"};try{(c=c.replace(/\/$/,"")).endsWith("/messages")&&(c=c.slice(0,-9));let d=await r(`${c}/models`,{headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01",Authorization:`Bearer ${a.apiKey}`}},b);return{valid:d.ok,error:d.ok?null:"Invalid API key or base URL"}}catch(a){return{valid:!1,error:a.message}}}try{switch(a.provider){case"cloudflare-ai":{let c=(a.providerSpecificData||{}).accountId;if(!c)return{valid:!1,error:"Missing Account ID"};let d=`https://api.cloudflare.com/client/v4/accounts/${c}/ai/v1/chat/completions`,e=await r(d,{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({model:(0,i.fZ)("cloudflare-ai"),messages:[{role:"user",content:"test"}],max_tokens:1})},b),f=401!==e.status&&403!==e.status&&404!==e.status;return{valid:f,error:f?null:"Invalid API token or Account ID"}}case"azure":{let c=a.providerSpecificData||{},d=(c.azureEndpoint||"").replace(/\/$/,""),e=c.deployment||"gpt-4",f=c.apiVersion||"2024-10-01-preview",g=`${d}/openai/deployments/${e}/chat/completions?api-version=${f}`,h={"api-key":a.apiKey,"Content-Type":"application/json"};c.organization&&(h["OpenAI-Organization"]=c.organization);let i=await r(g,{method:"POST",headers:h,body:JSON.stringify({messages:[{role:"user",content:"test"}],max_completion_tokens:1})},b),j=401!==i.status&&403!==i.status;return{valid:j,error:j?null:"Invalid API key or Azure configuration"}}case"openai":{let c=await r("https://api.openai.com/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"vercel-ai-gateway":{let c=await r("https://ai-gateway.vercel.sh/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"anthropic":{let c=await r("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"claude-3-haiku-20240307",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"gemini":{let c=await r(`https://generativelanguage.googleapis.com/v1/models?key=${a.apiKey}`,{},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"openrouter":{let c=await r("https://openrouter.ai/api/v1/auth/key",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"glm":{let c=await r("https://api.z.ai/api/anthropic/v1/messages",{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"glm-4.7",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"glm-cn":{let c=await r("https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"content-type":"application/json"},body:JSON.stringify({model:"glm-4.7",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"minimax":case"minimax-cn":{let c=await r({minimax:"https://api.minimax.io/anthropic/v1/messages","minimax-cn":"https://api.minimaxi.com/anthropic/v1/messages"}[a.provider],{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"minimax-m2",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"kimi":{let c=await r("https://api.kimi.com/coding/v1/messages",{method:"POST",headers:{"x-api-key":a.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:"kimi-latest",max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"alicode":case"alicode-intl":{let c="alicode-intl"===a.provider?"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions":"https://coding.dashscope.aliyuncs.com/v1/chat/completions",d=await r(c,{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"content-type":"application/json"},body:JSON.stringify({model:(0,i.fZ)(a.provider),max_tokens:1,messages:[{role:"user",content:"test"}]})},b),e=401!==d.status&&403!==d.status;return{valid:e,error:e?null:"Invalid API key"}}case"volcengine-ark":case"byteplus":{let c=await r(h.X3[a.provider],{method:"POST",headers:{Authorization:`Bearer ${a.apiKey}`,"content-type":"application/json"},body:JSON.stringify({model:(0,i.fZ)(a.provider),max_tokens:1,messages:[{role:"user",content:"test"}]})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"deepseek":{let c=await r("https://api.deepseek.com/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"groq":{let c=await r("https://api.groq.com/openai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"mistral":{let c=await r("https://api.mistral.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"xai":{let c=await r("https://api.x.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"nvidia":{let c=await r("https://integrate.api.nvidia.com/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"perplexity":{let c=await r("https://api.perplexity.ai/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"together":{let c=await r("https://api.together.xyz/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"fireworks":{let c=await r("https://api.fireworks.ai/inference/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"cerebras":{let c=await r("https://api.cerebras.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"cohere":{let c=await r("https://api.cohere.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"nebius":{let c=await r("https://api.studio.nebius.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"siliconflow":{let c=await r("https://api.siliconflow.cn/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"hyperbolic":{let c=await r("https://api.hyperbolic.xyz/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"ollama":{let b=await fetch("https://ollama.com/api/tags",{headers:{Authorization:`Bearer ${a.apiKey}`}});return{valid:b.ok,error:b.ok?null:"Invalid API key"}}case"ollama-local":{let b=(0,j.Ak)(a),c=await fetch(`${b}/api/tags`);return{valid:c.ok,error:c.ok?null:`Ollama not reachable at ${b}`}}case"deepgram":{let c=await r("https://api.deepgram.com/v1/projects",{headers:{Authorization:`Token ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"assemblyai":{let c=await r("https://api.assemblyai.com/v1/account",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"nanobanana":{let c=await r("https://api.nanobananaapi.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"fal-ai":{let c=await r("https://api.fal.ai/v1/models?limit=1",{headers:{Authorization:`Key ${a.apiKey}`}},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"chutes":{let c=await r("https://llm.chutes.ai/v1/models",{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"grok-web":{let c=a.apiKey.startsWith("sso=")?a.apiKey.slice(4):a.apiKey,d=a=>Array.from(crypto.getRandomValues(new Uint8Array(a)),a=>a.toString(16).padStart(2,"0")).join(""),e=Buffer.from("e:TypeError: Cannot read properties of null (reading 'children')").toString("base64"),f=await r("https://grok.com/rest/app-chat/conversations/new",{method:"POST",headers:{Accept:"*/*","Content-Type":"application/json",Cookie:`sso=${c}`,Origin:"https://grok.com",Referer:"https://grok.com/","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36","x-statsig-id":e,"x-xai-request-id":crypto.randomUUID(),traceparent:`00-${d(16)}-${d(8)}-00`},body:JSON.stringify({temporary:!0,modelName:"grok-4",message:"ping",fileAttachments:[],imageAttachments:[],disableSearch:!1,enableImageGeneration:!1,sendFinalMetadata:!0})},b),g=401!==f.status&&403!==f.status;return{valid:g,error:g?null:"Invalid SSO cookie"}}case"perplexity-web":{let c=a.apiKey;c.startsWith("__Secure-next-auth.session-token=")&&(c=c.slice(33));let d=await r("https://www.perplexity.ai/api/auth/session",{method:"GET",headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",Cookie:`__Secure-next-auth.session-token=${c}`}},b);if(!d.ok)return{valid:!1,error:"Invalid session cookie"};let e=await d.json().catch(()=>null),f=!!(e&&e.user);return{valid:f,error:f?null:"Session expired — re-paste cookie"}}case"opencode-go":{let c=await r("https://opencode.ai/zen/go/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a.apiKey}`},body:JSON.stringify({model:(0,i.fZ)("opencode-go"),messages:[{role:"user",content:"ping"}],max_tokens:1,stream:!1})},b),d=401!==c.status&&403!==c.status;return{valid:d,error:d?null:"Invalid API key"}}case"xiaomi-mimo":case"xiaomi-tokenplan":{let c=await r(`${{"xiaomi-mimo":"https://api.xiaomimimo.com/v1","xiaomi-tokenplan":"https://token-plan-sgp.xiaomimimo.com/v1"}[a.provider]}/models`,{headers:{Authorization:`Bearer ${a.apiKey}`}},b);return{valid:c.ok,error:c.ok?null:"Invalid API key"}}case"codebuddy":case"codebuddy-cn":{let c="codebuddy-cn"===a.provider?l.ne:l.Nl,d=c.baseUrl,e=await r(`${d}/v2/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":c.userAgent,"X-Domain":c.domain,"X-Requested-With":"XMLHttpRequest","X-Product":"SaaS","X-Api-Key":a.apiKey},body:JSON.stringify({model:"default-model-lite",max_tokens:1,messages:[{role:"user",content:"hi"}]})},b),f=e.ok||429===e.status||400===e.status;return{valid:f,error:f?null:`Invalid API key (${e.status})`}}default:return{valid:!1,error:"Provider test not supported"}}}catch(a){return{valid:!1,error:a.message}}}async function t(a){let b,c=await (0,d.Mc)(a);if(!c)return{valid:!1,error:"Connection not found",latencyMs:0,testedAt:new Date().toISOString()};let g=await (0,e.B)(c.providerSpecificData||{});if(g.connectionProxyEnabled&&g.connectionProxyUrl&&!g.vercelRelayUrl){let b=await (0,f.C)({proxyUrl:g.connectionProxyUrl});if(!b.ok){let c=b.error||`Proxy test failed with status ${b.status}`;return await (0,d.updateProviderConnection)(a,{testStatus:"error",lastError:c,lastErrorAt:new Date().toISOString()}),{valid:!1,error:c,latencyMs:0,testedAt:new Date().toISOString()}}}let h=Date.now();b="apikey"===c.authType||"cookie"===c.authType?await s(c,g):await q(c,g);let i=Date.now()-h,j={testStatus:b.valid?"active":"error",lastError:b.valid?null:b.error,lastErrorAt:b.valid?null:new Date().toISOString()};return b.refreshed&&b.newTokens&&(b.newTokens.accessToken&&(j.accessToken=b.newTokens.accessToken),b.newTokens.refreshToken&&(j.refreshToken=b.newTokens.refreshToken),b.newTokens.idToken&&(j.idToken=b.newTokens.idToken),b.newTokens.lastRefreshAt&&(j.lastRefreshAt=b.newTokens.lastRefreshAt),b.newTokens.expiresIn&&(j.expiresIn=b.newTokens.expiresIn),b.newTokens.expiresIn?j.expiresAt=new Date(Date.now()+1e3*b.newTokens.expiresIn).toISOString():b.newTokens.expiresAt&&(j.expiresAt=b.newTokens.expiresAt),b.newTokens.providerSpecificData&&(j.providerSpecificData={...c.providerSpecificData||{},...b.newTokens.providerSpecificData})),await (0,d.updateProviderConnection)(a,j),{valid:b.valid,error:b.error,refreshed:!!b.refreshed,latencyMs:i,testedAt:new Date().toISOString()}}},71998:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Yd:()=>d.Yd,ZO:()=>d.ZO,c:()=>d.c,createProviderConnection:()=>d.iE,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.getProviderConnections,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,o5:()=>d.o5,op:()=>d.op,rj:()=>d.updateProviderConnection,uL:()=>d.uL,ui:()=>d.ui,uv:()=>d.uv});var d=c(89718)},74926:(a,b,c)=>{c.d(b,{C:()=>f});var d=c(47774);function e(a){return null==a?"":String(a).trim()}async function f({proxyUrl:a,testUrl:b,timeoutMs:c}={}){let g,h=e(a);if(!h)return{ok:!1,status:400,error:"proxyUrl is required"};let i=e(b)||"https://google.com/",j=Number(c),k=Number.isFinite(j)&&j>0?Math.min(j,3e4):8e3;try{try{g=new d.ProxyAgent({uri:h})}catch(a){return{ok:!1,status:400,error:`Invalid proxy URL: ${a?.message||String(a)}`}}let a=new AbortController,b=Date.now(),c=setTimeout(()=>a.abort(),k);try{let c=await (0,d.hd)(i,{method:"HEAD",dispatcher:g,signal:a.signal,headers:{"User-Agent":"9Router"}});return{ok:c.ok,status:c.status,statusText:c.statusText,url:i,elapsedMs:Date.now()-b}}catch(b){let a=b?.name==="AbortError"?"Proxy test timed out":function(a){if(!a)return"Unknown error";let b=a?.message||String(a),c=a?.cause?.code||a?.code,d=a?.cause?.message;return d&&d!==b?c?`${b}: ${d} (${c})`:`${b}: ${d}`:c&&!b.includes(c)?`${b} (${c})`:b}(b);return{ok:!1,status:500,error:a}}finally{clearTimeout(c)}}finally{try{await g?.close?.()}catch{}}}},81329:(a,b,c)=>{c.d(b,{Xg:()=>d.Xg,eh:()=>e,vq:()=>d.vq});var d=c(44404);Object.entries(c(75681).AI_PROVIDERS).filter(([,a])=>a.passthroughModels).map(([a])=>a);let e=Object.entries(d.vq).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name})))},89718:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,KK:()=>d.KK,L:()=>d.L,L9:()=>d.L9,LF:()=>d.LF,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(1399)},92990:(a,b,c)=>{c.d(b,{DI:()=>g,Hp:()=>i,LT:()=>h,MZ:()=>r,Nl:()=>u,Nu:()=>n,OV:()=>f,Tx:()=>o,WN:()=>p,Ww:()=>w,YT:()=>l,ZL:()=>k,cD:()=>m,f7:()=>t,hF:()=>j,lB:()=>s,ne:()=>v,t:()=>q});var d=c(21820);function e(){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 f={clientId:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",authorizeUrl:"https://claude.ai/oauth/authorize",tokenUrl:"https://api.anthropic.com/v1/oauth/token",scopes:["org:create_api_key","user:profile","user:inference"],codeChallengeMethod:"S256"},g={clientId:"app_EMoamEEZ73f0CkXaXp7hrann",authorizeUrl:"https://auth.openai.com/oauth/authorize",tokenUrl:"https://auth.openai.com/oauth/token",scope:"openid profile email offline_access",codeChallengeMethod:"S256",extraParams:{id_token_add_organizations:"true",codex_cli_simplified_flow:"true",originator:"codex_cli_rs"}},h={clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",userInfoUrl:"https://www.googleapis.com/oauth2/v1/userinfo",scopes:["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/userinfo.profile"]},i={clientId:"f0304373b74a44d2b584a3fb70ca9e56",deviceCodeUrl:"https://chat.qwen.ai/api/v1/oauth2/device/code",tokenUrl:"https://chat.qwen.ai/api/v1/oauth2/token",scope:"openid profile email model.completion",codeChallengeMethod:"S256"},j={openApiBaseUrl:"https://openapi.qoder.sh",centerBaseUrl:"https://center.qoder.sh",chatBaseUrl:"https://api3.qoder.sh",deviceTokenUrl:"https://openapi.qoder.sh/api/v1/deviceToken/poll",refreshUrl:"https://center.qoder.sh/algo/api/v3/user/refresh_token",userInfoUrl:"https://openapi.qoder.sh/api/v1/userinfo",quotaUsageUrl:"https://openapi.qoder.sh/api/v2/quota/usage",loginUrl:"https://qoder.com/device/selectAccounts"},k={clientId:"10009311001",clientSecret:"4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",authorizeUrl:"https://iflow.cn/oauth",tokenUrl:"https://iflow.cn/oauth/token",userInfoUrl:"https://iflow.cn/api/oauth/getUserInfo",extraParams:{loginMethod:"phone",type:"phone"}},l={clientId:"1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",clientSecret:"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",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",userInfoUrl:"https://www.googleapis.com/oauth2/v1/userinfo",scopes:["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/cclog","https://www.googleapis.com/auth/experimentsandconfigs"],apiEndpoint:"https://cloudcode-pa.googleapis.com",apiVersion:"v1internal",loadCodeAssistEndpoint:"https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",onboardUserEndpoint:"https://cloudcode-pa.googleapis.com/v1internal:onboardUser",loadCodeAssistUserAgent:"google-api-nodejs-client/9.15.1",loadCodeAssistApiClient:"google-cloud-sdk vscode_cloudshelleditor/0.1",loadCodeAssistClientMetadata:JSON.stringify({ideType:9,platform:e(),pluginType:2})};function m(){return{ideType:9,platform:e(),pluginType:2}}let n={clientId:"Iv1.b507a08c87ecfe98",deviceCodeUrl:"https://github.com/login/device/code",tokenUrl:"https://github.com/login/oauth/access_token",userInfoUrl:"https://api.github.com/user",scopes:"read:user",apiVersion:"2022-11-28",copilotTokenUrl:"https://api.github.com/copilot_internal/v2/token",userAgent:"GitHubCopilotChat/0.26.7",editorVersion:"vscode/1.85.0",editorPluginVersion:"copilot-chat/0.26.7"},o={ssoOidcEndpoint:"https://oidc.us-east-1.amazonaws.com",registerClientUrl:"https://oidc.us-east-1.amazonaws.com/client/register",deviceAuthUrl:"https://oidc.us-east-1.amazonaws.com/device_authorization",tokenUrl:"https://oidc.us-east-1.amazonaws.com/token",startUrl:"https://view.awsapps.com/start",clientName:"kiro-oauth-client",clientType:"public",scopes:["codewhisperer:completions","codewhisperer:analysis","codewhisperer:conversations"],grantTypes:["urn:ietf:params:oauth:grant-type:device_code","refresh_token"],issuerUrl:"https://identitycenter.amazonaws.com/ssoins-722374e8c3c8e6c6",socialAuthEndpoint:"https://prod.us-east-1.auth.desktop.kiro.dev",socialLoginUrl:"https://prod.us-east-1.auth.desktop.kiro.dev/login",socialTokenUrl:"https://prod.us-east-1.auth.desktop.kiro.dev/oauth/token",socialRefreshUrl:"https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",authMethods:["builder-id","idc","google","github","import"]},p={apiEndpoint:"https://api2.cursor.sh",chatEndpoint:"/aiserver.v1.ChatService/StreamUnifiedChatWithTools",modelsEndpoint:"/aiserver.v1.AiService/GetDefaultModelNudgeData",api3Endpoint:"https://api3.cursor.sh",agentEndpoint:"https://agent.api5.cursor.sh",agentNonPrivacyEndpoint:"https://agentn.api5.cursor.sh",clientVersion:"3.1.0",clientType:"ide",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"},dbKeys:{accessToken:"cursorAuth/accessToken",machineId:"storage.serviceMachineId"}},q={clientId:process.env.KIMI_CODING_OAUTH_CLIENT_ID||"17e5f671-d194-4dfb-9706-5516cb48c098",deviceCodeUrl:"https://auth.kimi.com/api/oauth/device_authorization",tokenUrl:"https://auth.kimi.com/api/oauth/token"},r={apiBaseUrl:"https://api.kilo.ai",initiateUrl:"https://api.kilo.ai/api/device-auth/codes",pollUrlBase:"https://api.kilo.ai/api/device-auth/codes"},s={appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",authorizeUrl:"https://api.cline.bot/api/v1/auth/authorize",tokenExchangeUrl:"https://api.cline.bot/api/v1/auth/token",refreshUrl:"https://api.cline.bot/api/v1/auth/refresh"},t={defaultBaseUrl:"https://gitlab.com",authorizeUrlPath:"/oauth/authorize",tokenUrlPath:"/oauth/token",userInfoUrlPath:"/api/v4/user",scope:"api read_user",codeChallengeMethod:"S256"},u={baseUrl:"https://www.codebuddy.ai",stateUrl:"https://www.codebuddy.ai/v2/plugin/auth/state",tokenUrl:"https://www.codebuddy.ai/v2/plugin/auth/token",accountUrl:"https://www.codebuddy.ai/v2/plugin/login/account",accountsUrl:"https://www.codebuddy.ai/v2/plugin/accounts",refreshUrl:"https://www.codebuddy.ai/v2/plugin/auth/token/refresh",userAgent:"CLI/2.63.2 CodeBuddy/2.63.2",domain:"www.codebuddy.ai",platform:"CLI",pollInterval:5e3},v={baseUrl:"https://www.codebuddy.cn",stateUrl:"https://www.codebuddy.cn/v2/plugin/auth/state",tokenUrl:"https://www.codebuddy.cn/v2/plugin/auth/token",accountUrl:"https://www.codebuddy.cn/v2/plugin/login/account",accountsUrl:"https://www.codebuddy.cn/v2/plugin/accounts",refreshUrl:"https://www.codebuddy.cn/v2/plugin/auth/token/refresh",userAgent:"CLI/2.63.2 CodeBuddy/2.63.2",domain:"www.codebuddy.cn",platform:"CLI",pollInterval:5e3},w=3e5},93943:(a,b,c)=>{c.d(b,{Vq:()=>i,fp:()=>g});var d=c(8590);let e=new Map;function f(a){if(null==a||""===a)return null;if("number"==typeof a)return a<1e12?1e3*a:a;let b=new Date(a).getTime();return Number.isFinite(b)?b:null}function g(a,b,c=Date.now()){if(!b)return!1;let e=f(b?.expiresAt??b?.tokenExpiresAt);return!!(null!==e&&e-c<(0,d.Og)(a)||"codex"===a&&b.refreshToken&&function(a,b=Date.now()){let c=f(a?.lastRefreshAt??a?.lastRefresh??a?.providerSpecificData?.lastRefreshAt);return!c||b-c>=6912e5}(b,c))}async function h(a,b,c){let d,f=(d=b?.connectionId||b?.id||b?.email||b?.name||b?.refreshToken?.slice?.(-16)||"default",`${a}:${d}`),g=e.get(f);if(g)return g;let h=Promise.resolve().then(c).finally(()=>{e.delete(f)});return e.set(f,h),h}async function i(a,b,c){return b?h(a,b,async()=>{let e=await (0,d.$B)(a,b,c);return function(a,b,c,e=Date.now()){var f,g;if(!c)return null;if((0,d.jT)(c))return c;let h={},i=new Date(e).toISOString();c.accessToken&&(h.accessToken=c.accessToken),c.apiKey&&(h.apiKey=c.apiKey),c.token&&(h.token=c.token);let j=c.refreshToken??b?.refreshToken;j&&(h.refreshToken=j);let k=c.idToken??b?.idToken;return k&&(h.idToken=k),c.expiresIn?(h.expiresIn=c.expiresIn,h.expiresAt=function(a,b=Date.now()){return a?new Date(b+1e3*a).toISOString():null}(c.expiresIn,e)):c.expiresAt&&(h.expiresAt=c.expiresAt),c.projectId&&(h.projectId=c.projectId),c.providerSpecificData&&(f=b?.providerSpecificData,h.providerSpecificData=(g=c.providerSpecificData)&&"object"==typeof g?{...f||{},...g}:f),c.copilotToken&&(h.copilotToken=c.copilotToken),c.copilotTokenExpiresAt&&(h.copilotTokenExpiresAt=c.copilotTokenExpiresAt),("codex"===a||h.accessToken||h.apiKey||h.token||h.refreshToken||h.copilotToken)&&(h.lastRefreshAt=c.lastRefreshAt||i),h}(a,b,e)}):null}},94755:(a,b,c)=>{c.d(b,{A:()=>i});var d=c(77598);let e={randomUUID:d.randomUUID},f=new Uint8Array(256),g=f.length;var h=c(50122);let i=function(a,b,c){if(e.randomUUID&&!b&&!a)return e.randomUUID();var i=a,j=c;let k=(i=i||{}).random??i.rng?.()??(g>f.length-16&&((0,d.randomFillSync)(f),g=0),f.slice(g,g+=16));if(k.length<16)throw Error("Random bytes length must be >= 16");if(k[6]=15&k[6]|64,k[8]=63&k[8]|128,b){if((j=j||0)<0||j+16>b.length)throw RangeError(`UUID byte range ${j}:${j+15} is out of buffer bounds`);for(let a=0;a<16;++a)b[j+a]=k[a];return b}return(0,h.k)(k)}}};
@@ -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"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},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",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"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)"]},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)"]}};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(", ")})`}}};
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"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},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",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"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)"]},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)"]},quotaCache:{columns:{connectionId:"TEXT PRIMARY KEY",provider:"TEXT",data:"TEXT NOT NULL",fetchedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_qc_provider ON quotaCache(provider)"]}};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(", ")})`}}};
@@ -1 +1 @@
1
- "use strict";exports.id=1517,exports.ids=[1517],exports.modules={2574:(a,b,c)=>{c.r(b),c.d(b,{GET:()=>s,OPTIONS:()=>r,buildModelsList:()=>q});var d=c(81329),e=c(75681),f=c(89718),g=c(16655),h=c(29679),i=c(53225),j=c(3359);let k={kiro:async a=>{let b=await (0,h.cW)({accessToken:a.accessToken,refreshToken:a.refreshToken,providerSpecificData:a.providerSpecificData||{}},{log:console});return b?.models?.length?{models:b.models}:null},qoder:async a=>{let b=await (0,i.EV)({accessToken:a.accessToken,refreshToken:a.refreshToken,email:a.email,displayName:a.displayName,providerSpecificData:a.providerSpecificData||{}});return b?.models?.length?{models:b.models.map(a=>({id:a.id,name:a.name}))}:null}},l=/[-_][0-9a-f]{8,}$/i,m={image:"image",tts:"tts",embedding:"embedding",stt:"stt",imageToText:"imageToText"};function n(a){return a?.type&&m[a.type]||"llm"}async function o(a){if(!a?.apiKey)return[];let b="string"==typeof a?.providerSpecificData?.baseUrl?a.providerSpecificData.baseUrl.trim().replace(/\/$/,""):"";if(!b)return[];let c=`${b}/models`,d={"Content-Type":"application/json"};if((0,e.mq)(a.provider))d.Authorization=`Bearer ${a.apiKey}`;else{if(!(0,e.gb)(a.provider))return[];c.endsWith("/messages/models")?c=c.slice(0,-9):c.endsWith("/messages")&&(c=`${c.slice(0,-9)}/models`),d["x-api-key"]=a.apiKey,d["anthropic-version"]="2023-06-01",d.Authorization=`Bearer ${a.apiKey}`}try{var f;let a=new AbortController,b=setTimeout(()=>a.abort(),5e3),e=await fetch(c,{method:"GET",headers:d,cache:"no-store",signal:a.signal});if(clearTimeout(b),!e.ok)return[];let g=(f=await e.json(),Array.isArray(f)?f:f?.data||f?.models||f?.results||[]);return Array.from(new Set(g.map(a=>a?.id||a?.name||a?.model).filter(a=>"string"==typeof a&&""!==a.trim())))}catch{return[]}}function p(a,b){let c=e.AI_PROVIDERS[a],d=Array.isArray(c?.serviceKinds)&&c.serviceKinds.length>0?c.serviceKinds:["llm"];return b.some(a=>d.includes(a))}async function q(a){let b=[];try{b=(b=await (0,f.getProviderConnections)()).filter(a=>!1!==a.isActive)}catch(a){console.log("Could not fetch providers, returning all models")}let c=[];try{c=await (0,f.Uv)()}catch(a){console.log("Could not fetch combos")}let h=[];try{h=await (0,f.uv)()}catch(a){console.log("Could not fetch custom models")}let i={};try{i=await (0,f.OM)()}catch(a){console.log("Could not fetch model aliases")}let m={};try{m=await (0,g.vF)()}catch(a){console.log("Could not fetch disabled models")}let q=(a,b)=>Array.isArray(m[a])&&m[a].includes(b),r=new Map;for(let a of b)r.has(a.provider)||r.set(a.provider,a);let s=[];for(let b of c){if(!function(a,b){let c=a?.kind||"llm";return b.includes(c)}(b,a))continue;let c={id:b.name,object:"model",owned_by:"combo"};("webSearch"===b.kind||"webFetch"===b.kind)&&(c.kind=b.kind),s.push(c)}if(0===b.length){let b=Object.fromEntries(Object.entries(d.Xg).map(([a,b])=>[b,a]));for(let[c,e]of Object.entries(d.vq))if(p(b[c]||c,a))for(let b of e)a.includes(n(b))&&(q(c,b.id)||s.push({id:`${c}/${b.id}`,object:"model",owned_by:c}));for(let b of h){if(!b?.id||b.type&&"llm"!==b.type||!a.includes("llm"))continue;let c=b.providerAlias;if(!c)continue;let d=String(b.id).trim();d&&s.push({id:`${c}/${d}`,object:"model",owned_by:c})}}else for(let[b,c]of r.entries()){if(!p(b,a))continue;let f=d.Xg[b]||b,g=(c?.providerSpecificData?.prefix||(0,e.wG)(b)||f).trim(),j=d.vq[f]||[],m=c?.providerSpecificData?.enabledModels,r=Array.isArray(m)&&m.length>0,t=(0,e.mq)(b)||(0,e.gb)(b),u=new Map(j.map(a=>[a.id,n(a)])),v=r?Array.from(new Set(m.filter(a=>"string"==typeof a&&""!==a.trim()))):j.map(a=>a.id);t&&0===v.length&&!l.test(b)&&(v=await o(c));let w=k[b];if(w&&!r)try{let a=await w(c);a?.models?.length&&(v=a.models.map(a=>a.id))}catch(a){console.log(`Live model fetch failed for ${b}: ${a?.message||a}`)}for(let c of Array.from(new Set([...v.map(a=>a.startsWith(`${g}/`)?a.slice(g.length+1):a.startsWith(`${f}/`)?a.slice(f.length+1):a.startsWith(`${b}/`)?a.slice(b.length+1):a).filter(a=>"string"==typeof a&&""!==a.trim()),...h.filter(a=>{if(!a?.id||a.type&&"llm"!==a.type)return!1;let c=a.providerAlias;return c===f||c===g||c===b}).map(a=>String(a.id).trim()).filter(a=>""!==a),...Object.values(i||{}).filter(a=>"string"==typeof a&&!!a.includes("/")&&(a.startsWith(`${g}/`)||a.startsWith(`${f}/`)||a.startsWith(`${b}/`))).map(a=>a.startsWith(`${g}/`)?a.slice(g.length+1):a.startsWith(`${f}/`)?a.slice(f.length+1):a.startsWith(`${b}/`)?a.slice(b.length+1):a).filter(a=>"string"==typeof a&&""!==a.trim())]))){let b=u.get(c)||function(a){let b=String(a).toLowerCase();return/embed/.test(b)?"embedding":/tts|speech|audio|voice/.test(b)?"tts":/image|imagen|dall-?e|flux|sdxl|sd-|stable-diffusion/.test(b)?"image":"llm"}(c);a.includes(b)&&(q(g,c)||q(f,c)||s.push({id:`${g}/${c}`,object:"model",owned_by:g}))}let x=e.AI_PROVIDERS[b],y=[];if(a.includes("tts")&&Array.isArray(x?.ttsConfig?.models))for(let a of x.ttsConfig.models)a?.id&&y.push(a.id);if(a.includes("embedding")&&Array.isArray(x?.embeddingConfig?.models))for(let a of x.embeddingConfig.models)a?.id&&y.push(a.id);for(let a of y)q(g,a)||q(f,a)||s.push({id:`${g}/${a}`,object:"model",owned_by:g});a.includes("webSearch")&&x?.searchConfig&&s.push({id:`${g}/search`,object:"model",kind:"webSearch",owned_by:g}),a.includes("webFetch")&&x?.fetchConfig&&s.push({id:`${g}/fetch`,object:"model",kind:"webFetch",owned_by:g})}a.includes("llm")&&s.push(...(0,j.lL)(b));let t=[],u=new Set;for(let a of s)!a?.id||u.has(a.id)||(u.add(a.id),t.push(a));return t}async function r(){return new Response(null,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"*"}})}async function s(){try{let a=await q(["llm"]);return Response.json({object:"list",data:a},{headers:{"Access-Control-Allow-Origin":"*"}})}catch(a){return console.log("Error fetching models:",a),Response.json({error:{message:a.message,type:"server_error"}},{status:500})}}},3359:(a,b,c)=>{c.d(b,{K0:()=>j,Oh:()=>n,c9:()=>q,lL:()=>r,s9:()=>i});var d=c(89718),e=c(44404);let f="gpt-5.5";function g(a){return String(a||"").trim().replace(/^\/+|\/+$/g,"")}function h(a){let b;return`cx/${(b=g(a)).startsWith("cx/")?b.slice(3):b.startsWith("codex/")?b.slice(6):b||f}`}function i(a){let b=g(a);if(!b)return null;if("auto-codex"===b)return{mode:"router",modelString:`cx/${f}`,strictAccount:!1,label:"Auto Codex"};if(b.startsWith("router/")){let a;return{mode:"router",modelString:(a=g(b.slice(7))||f).includes("/")?a:`cx/${a}`,strictAccount:!1,label:"Router Pool"}}if(b.startsWith("original/"))return{mode:"original",modelString:h(b.slice(9)),strictAccount:!0,label:"Original Codex"};if("original"===b)return{mode:"original",modelString:`cx/${f}`,strictAccount:!0,label:"Original Codex"};let c=b.startsWith("account/")?"account/":b.startsWith("codex-account/")?"codex-account/":null;if(c){let a=b.slice(c.length),d=a.indexOf("/"),e=-1===d?a:a.slice(0,d),g=-1===d?f:a.slice(d+1);return e?{mode:"account",accountRef:e,modelString:h(g),strictAccount:!0,label:"Pinned Codex Account"}:null}return null}function j(a){return a?.displayName||a?.name||a?.email||a?.id||"Codex account"}function k(a){let b=String(j(a)).toLowerCase().replace(/@/g,"-").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"account";return`${b}-${String(a?.id||"").slice(0,8)}`}function l(a){return String(a||"").trim().toLowerCase()}function m(a){let b=a?.providerSpecificData||{};return"GPTJson"===b.importedFrom||String(b.tokenSource||"").startsWith("ChatGPT_team")}async function n(a=5e3){let b=await (0,d.getProviderConnections)({provider:"codex",isActive:!0}),c=b.slice(0,a).map(a=>({id:a.id,slug:k(a),label:j(a),email:a.email||null,imported:m(a),priority:a.priority||null})),e=o(b);return{accounts:c,original:e?{id:e.id,slug:k(e),label:j(e),email:e.email||null,imported:m(e),priority:e.priority||null}:null}}function o(a){return Array.isArray(a)&&0!==a.length?a.find(a=>!m(a))||a[0]:null}async function p(a){let b=l(a);if(!b)return null;let c=await (0,d.getProviderConnections)({provider:"codex",isActive:!0}),e=c.find(a=>l(a.id)===b||k(a)===b||l(a.email)===b||l(a.name)===b||l(a.displayName)===b);if(e)return e;let f=c.filter(a=>l(a.id).startsWith(b)||k(a).startsWith(b));return 1===f.length?f[0]:null}async function q(a){if(!a||"original"!==a.mode&&"account"!==a.mode)return null;if("account"===a.mode)return p(a.accountRef);let b=await (0,d.mt)(),c=b.codexGatewayOriginalConnectionId||b.codexOriginalConnectionId||"";if(c){let a=await p(c);if(a)return a}return o(await (0,d.getProviderConnections)({provider:"codex",isActive:!0}))}function r(a=[]){if(!a.some(a=>"codex"===a.provider&&!1!==a.isActive))return[];let b=[{id:"auto-codex",object:"model",owned_by:"9router-codex-gateway"},...(e.vq.cx||[]).filter(a=>!a.type||"llm"===a.type).map(a=>a.id).flatMap(a=>[{id:`router/${a}`,object:"model",owned_by:"9router-codex-gateway"},{id:`original/${a}`,object:"model",owned_by:"9router-codex-gateway"}])];for(let c of a.filter(a=>"codex"===a.provider&&!1!==a.isActive))b.push({id:`account/${k(c)}`,object:"model",owned_by:"9router-codex-account"});return b}},16655:(a,b,c)=>{c.d(b,{oF:()=>d.oF,tm:()=>d.tm,vF:()=>d.vF});var d=c(9248)},19225:(a,b,c)=>{a.exports=c(44870)},50122:(a,b,c)=>{c.d(b,{k:()=>e});let d=[];for(let a=0;a<256;++a)d.push((a+256).toString(16).slice(1));function e(a,b=0){return(d[a[b+0]]+d[a[b+1]]+d[a[b+2]]+d[a[b+3]]+"-"+d[a[b+4]]+d[a[b+5]]+"-"+d[a[b+6]]+d[a[b+7]]+"-"+d[a[b+8]]+d[a[b+9]]+"-"+d[a[b+10]]+d[a[b+11]]+d[a[b+12]]+d[a[b+13]]+d[a[b+14]]+d[a[b+15]]).toLowerCase()}},89718:(a,b,c)=>{c.d(b,{CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q_:()=>d.Q_,Qu:()=>d.Qu,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,bI:()=>d.bI,c:()=>d.c,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,r4:()=>d.r4,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(9248)},92280:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},94755:(a,b,c)=>{c.d(b,{A:()=>i});var d=c(77598);let e={randomUUID:d.randomUUID},f=new Uint8Array(256),g=f.length;var h=c(50122);let i=function(a,b,c){if(e.randomUUID&&!b&&!a)return e.randomUUID();var i=a,j=c;let k=(i=i||{}).random??i.rng?.()??(g>f.length-16&&((0,d.randomFillSync)(f),g=0),f.slice(g,g+=16));if(k.length<16)throw Error("Random bytes length must be >= 16");if(k[6]=15&k[6]|64,k[8]=63&k[8]|128,b){if((j=j||0)<0||j+16>b.length)throw RangeError(`UUID byte range ${j}:${j+15} is out of buffer bounds`);for(let a=0;a<16;++a)b[j+a]=k[a];return b}return(0,h.k)(k)}}};
1
+ "use strict";exports.id=8255,exports.ids=[8255],exports.modules={2574:(a,b,c)=>{c.r(b),c.d(b,{GET:()=>s,OPTIONS:()=>r,buildModelsList:()=>q});var d=c(81329),e=c(75681),f=c(89718),g=c(16655),h=c(29679),i=c(53225),j=c(3359);let k={kiro:async a=>{let b=await (0,h.cW)({accessToken:a.accessToken,refreshToken:a.refreshToken,providerSpecificData:a.providerSpecificData||{}},{log:console});return b?.models?.length?{models:b.models}:null},qoder:async a=>{let b=await (0,i.EV)({accessToken:a.accessToken,refreshToken:a.refreshToken,email:a.email,displayName:a.displayName,providerSpecificData:a.providerSpecificData||{}});return b?.models?.length?{models:b.models.map(a=>({id:a.id,name:a.name}))}:null}},l=/[-_][0-9a-f]{8,}$/i,m={image:"image",tts:"tts",embedding:"embedding",stt:"stt",imageToText:"imageToText"};function n(a){return a?.type&&m[a.type]||"llm"}async function o(a){if(!a?.apiKey)return[];let b="string"==typeof a?.providerSpecificData?.baseUrl?a.providerSpecificData.baseUrl.trim().replace(/\/$/,""):"";if(!b)return[];let c=`${b}/models`,d={"Content-Type":"application/json"};if((0,e.mq)(a.provider))d.Authorization=`Bearer ${a.apiKey}`;else{if(!(0,e.gb)(a.provider))return[];c.endsWith("/messages/models")?c=c.slice(0,-9):c.endsWith("/messages")&&(c=`${c.slice(0,-9)}/models`),d["x-api-key"]=a.apiKey,d["anthropic-version"]="2023-06-01",d.Authorization=`Bearer ${a.apiKey}`}try{var f;let a=new AbortController,b=setTimeout(()=>a.abort(),5e3),e=await fetch(c,{method:"GET",headers:d,cache:"no-store",signal:a.signal});if(clearTimeout(b),!e.ok)return[];let g=(f=await e.json(),Array.isArray(f)?f:f?.data||f?.models||f?.results||[]);return Array.from(new Set(g.map(a=>a?.id||a?.name||a?.model).filter(a=>"string"==typeof a&&""!==a.trim())))}catch{return[]}}function p(a,b){let c=e.AI_PROVIDERS[a],d=Array.isArray(c?.serviceKinds)&&c.serviceKinds.length>0?c.serviceKinds:["llm"];return b.some(a=>d.includes(a))}async function q(a){let b=[];try{b=(b=await (0,f.getProviderConnections)()).filter(a=>!1!==a.isActive)}catch(a){console.log("Could not fetch providers, returning all models")}let c=[];try{c=await (0,f.Uv)()}catch(a){console.log("Could not fetch combos")}let h=[];try{h=await (0,f.uv)()}catch(a){console.log("Could not fetch custom models")}let i={};try{i=await (0,f.OM)()}catch(a){console.log("Could not fetch model aliases")}let m={};try{m=await (0,g.vF)()}catch(a){console.log("Could not fetch disabled models")}let q=(a,b)=>Array.isArray(m[a])&&m[a].includes(b),r=new Map;for(let a of b)r.has(a.provider)||r.set(a.provider,a);let s=[];for(let b of c){if(!function(a,b){let c=a?.kind||"llm";return b.includes(c)}(b,a))continue;let c={id:b.name,object:"model",owned_by:"combo"};("webSearch"===b.kind||"webFetch"===b.kind)&&(c.kind=b.kind),s.push(c)}if(0===b.length){let b=Object.fromEntries(Object.entries(d.Xg).map(([a,b])=>[b,a]));for(let[c,e]of Object.entries(d.vq))if(p(b[c]||c,a))for(let b of e)a.includes(n(b))&&(q(c,b.id)||s.push({id:`${c}/${b.id}`,object:"model",owned_by:c}));for(let b of h){if(!b?.id||b.type&&"llm"!==b.type||!a.includes("llm"))continue;let c=b.providerAlias;if(!c)continue;let d=String(b.id).trim();d&&s.push({id:`${c}/${d}`,object:"model",owned_by:c})}}else for(let[b,c]of r.entries()){if(!p(b,a))continue;let f=d.Xg[b]||b,g=(c?.providerSpecificData?.prefix||(0,e.wG)(b)||f).trim(),j=d.vq[f]||[],m=c?.providerSpecificData?.enabledModels,r=Array.isArray(m)&&m.length>0,t=(0,e.mq)(b)||(0,e.gb)(b),u=new Map(j.map(a=>[a.id,n(a)])),v=r?Array.from(new Set(m.filter(a=>"string"==typeof a&&""!==a.trim()))):j.map(a=>a.id);t&&0===v.length&&!l.test(b)&&(v=await o(c));let w=k[b];if(w&&!r)try{let a=await w(c);a?.models?.length&&(v=a.models.map(a=>a.id))}catch(a){console.log(`Live model fetch failed for ${b}: ${a?.message||a}`)}for(let c of Array.from(new Set([...v.map(a=>a.startsWith(`${g}/`)?a.slice(g.length+1):a.startsWith(`${f}/`)?a.slice(f.length+1):a.startsWith(`${b}/`)?a.slice(b.length+1):a).filter(a=>"string"==typeof a&&""!==a.trim()),...h.filter(a=>{if(!a?.id||a.type&&"llm"!==a.type)return!1;let c=a.providerAlias;return c===f||c===g||c===b}).map(a=>String(a.id).trim()).filter(a=>""!==a),...Object.values(i||{}).filter(a=>"string"==typeof a&&!!a.includes("/")&&(a.startsWith(`${g}/`)||a.startsWith(`${f}/`)||a.startsWith(`${b}/`))).map(a=>a.startsWith(`${g}/`)?a.slice(g.length+1):a.startsWith(`${f}/`)?a.slice(f.length+1):a.startsWith(`${b}/`)?a.slice(b.length+1):a).filter(a=>"string"==typeof a&&""!==a.trim())]))){let b=u.get(c)||function(a){let b=String(a).toLowerCase();return/embed/.test(b)?"embedding":/tts|speech|audio|voice/.test(b)?"tts":/image|imagen|dall-?e|flux|sdxl|sd-|stable-diffusion/.test(b)?"image":"llm"}(c);a.includes(b)&&(q(g,c)||q(f,c)||s.push({id:`${g}/${c}`,object:"model",owned_by:g}))}let x=e.AI_PROVIDERS[b],y=[];if(a.includes("tts")&&Array.isArray(x?.ttsConfig?.models))for(let a of x.ttsConfig.models)a?.id&&y.push(a.id);if(a.includes("embedding")&&Array.isArray(x?.embeddingConfig?.models))for(let a of x.embeddingConfig.models)a?.id&&y.push(a.id);for(let a of y)q(g,a)||q(f,a)||s.push({id:`${g}/${a}`,object:"model",owned_by:g});a.includes("webSearch")&&x?.searchConfig&&s.push({id:`${g}/search`,object:"model",kind:"webSearch",owned_by:g}),a.includes("webFetch")&&x?.fetchConfig&&s.push({id:`${g}/fetch`,object:"model",kind:"webFetch",owned_by:g})}a.includes("llm")&&s.push(...(0,j.lL)(b));let t=[],u=new Set;for(let a of s)!a?.id||u.has(a.id)||(u.add(a.id),t.push(a));return t}async function r(){return new Response(null,{headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"*"}})}async function s(){try{let a=await q(["llm"]);return Response.json({object:"list",data:a},{headers:{"Access-Control-Allow-Origin":"*"}})}catch(a){return console.log("Error fetching models:",a),Response.json({error:{message:a.message,type:"server_error"}},{status:500})}}},3359:(a,b,c)=>{c.d(b,{K0:()=>j,Oh:()=>n,c9:()=>q,lL:()=>r,s9:()=>i});var d=c(89718),e=c(44404);let f="gpt-5.5";function g(a){return String(a||"").trim().replace(/^\/+|\/+$/g,"")}function h(a){let b;return`cx/${(b=g(a)).startsWith("cx/")?b.slice(3):b.startsWith("codex/")?b.slice(6):b||f}`}function i(a){let b=g(a);if(!b)return null;if("auto-codex"===b)return{mode:"router",modelString:`cx/${f}`,strictAccount:!1,label:"Auto Codex"};if(b.startsWith("router/")){let a;return{mode:"router",modelString:(a=g(b.slice(7))||f).includes("/")?a:`cx/${a}`,strictAccount:!1,label:"Router Pool"}}if(b.startsWith("original/"))return{mode:"original",modelString:h(b.slice(9)),strictAccount:!0,label:"Original Codex"};if("original"===b)return{mode:"original",modelString:`cx/${f}`,strictAccount:!0,label:"Original Codex"};let c=b.startsWith("account/")?"account/":b.startsWith("codex-account/")?"codex-account/":null;if(c){let a=b.slice(c.length),d=a.indexOf("/"),e=-1===d?a:a.slice(0,d),g=-1===d?f:a.slice(d+1);return e?{mode:"account",accountRef:e,modelString:h(g),strictAccount:!0,label:"Pinned Codex Account"}:null}return null}function j(a){return a?.displayName||a?.name||a?.email||a?.id||"Codex account"}function k(a){let b=String(j(a)).toLowerCase().replace(/@/g,"-").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"account";return`${b}-${String(a?.id||"").slice(0,8)}`}function l(a){return String(a||"").trim().toLowerCase()}function m(a){let b=a?.providerSpecificData||{};return"GPTJson"===b.importedFrom||String(b.tokenSource||"").startsWith("ChatGPT_team")}async function n(a=5e3){let b=await (0,d.getProviderConnections)({provider:"codex",isActive:!0}),c=b.slice(0,a).map(a=>({id:a.id,slug:k(a),label:j(a),email:a.email||null,imported:m(a),priority:a.priority||null})),e=o(b);return{accounts:c,original:e?{id:e.id,slug:k(e),label:j(e),email:e.email||null,imported:m(e),priority:e.priority||null}:null}}function o(a){return Array.isArray(a)&&0!==a.length?a.find(a=>!m(a))||a[0]:null}async function p(a){let b=l(a);if(!b)return null;let c=await (0,d.getProviderConnections)({provider:"codex",isActive:!0}),e=c.find(a=>l(a.id)===b||k(a)===b||l(a.email)===b||l(a.name)===b||l(a.displayName)===b);if(e)return e;let f=c.filter(a=>l(a.id).startsWith(b)||k(a).startsWith(b));return 1===f.length?f[0]:null}async function q(a){if(!a||"original"!==a.mode&&"account"!==a.mode)return null;if("account"===a.mode)return p(a.accountRef);let b=await (0,d.mt)(),c=b.codexGatewayOriginalConnectionId||b.codexOriginalConnectionId||"";if(c){let a=await p(c);if(a)return a}return o(await (0,d.getProviderConnections)({provider:"codex",isActive:!0}))}function r(a=[]){if(!a.some(a=>"codex"===a.provider&&!1!==a.isActive))return[];let b=[{id:"auto-codex",object:"model",owned_by:"9router-codex-gateway"},...(e.vq.cx||[]).filter(a=>!a.type||"llm"===a.type).map(a=>a.id).flatMap(a=>[{id:`router/${a}`,object:"model",owned_by:"9router-codex-gateway"},{id:`original/${a}`,object:"model",owned_by:"9router-codex-gateway"}])];for(let c of a.filter(a=>"codex"===a.provider&&!1!==a.isActive))b.push({id:`account/${k(c)}`,object:"model",owned_by:"9router-codex-account"});return b}},16655:(a,b,c)=>{c.d(b,{oF:()=>d.oF,tm:()=>d.tm,vF:()=>d.vF});var d=c(1399)},19225:(a,b,c)=>{a.exports=c(44870)},81329:(a,b,c)=>{c.d(b,{Xg:()=>d.Xg,eh:()=>e,vq:()=>d.vq});var d=c(44404);Object.entries(c(75681).AI_PROVIDERS).filter(([,a])=>a.passthroughModels).map(([a])=>a);let e=Object.entries(d.vq).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name})))},92280:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}}};
@@ -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"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},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",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"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)"]},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)"]}};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(", ")})`}},88520:(a,b,c)=>{c.d(b,{createNodeSqliteAdapter:()=>e});var d=c(63775);async function e(a){let b=process.emit;process.emit=function(a,c,...d){return!("warning"===a&&c?.name==="ExperimentalWarning"&&/SQLite/i.test(c.message||""))&&b.call(process,a,c,...d)};let e=new(await Promise.resolve().then(c.t.bind(c,79868,23))).DatabaseSync(a);e.exec(d.oG);let f=new Map;function g(a){let b=f.get(a);return b||(b=e.prepare(a),f.set(a,b)),b}let h=setInterval(()=>{try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);function i(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{f.clear()}catch{}try{e.close()}catch{}}"function"==typeof h.unref&&h.unref();let j=()=>i();return process.once("beforeExit",j),process.once("SIGINT",()=>{j(),process.exit(0)}),process.once("SIGTERM",()=>{j(),process.exit(0)}),{driver:"node:sqlite",run(a,b=[]){let c=g(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>g(a).get(...b),all:(a,b=[])=>g(a).all(...b),exec:a=>e.exec(a),transaction(a){let b=`sp_${Math.random().toString(36).slice(2)}`;e.exec(`SAVEPOINT ${b}`);try{let c=a();return e.exec(`RELEASE ${b}`),c}catch(a){try{e.exec(`ROLLBACK TO ${b}`),e.exec(`RELEASE ${b}`)}catch{}throw a}},checkpoint(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(h),i()},raw:e}}}};
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"},indexes:["CREATE INDEX IF NOT EXISTS idx_ak_key ON apiKeys(key)"]},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",apiKey:"TEXT",endpoint:"TEXT",promptTokens:"INTEGER DEFAULT 0",completionTokens:"INTEGER DEFAULT 0",cost:"REAL DEFAULT 0",status:"TEXT",tokens:"TEXT",meta:"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)"]},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)"]},quotaCache:{columns:{connectionId:"TEXT PRIMARY KEY",provider:"TEXT",data:"TEXT NOT NULL",fetchedAt:"TEXT NOT NULL"},indexes:["CREATE INDEX IF NOT EXISTS idx_qc_provider ON quotaCache(provider)"]}};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(", ")})`}},88520:(a,b,c)=>{c.d(b,{createNodeSqliteAdapter:()=>e});var d=c(63775);async function e(a){let b=process.emit;process.emit=function(a,c,...d){return!("warning"===a&&c?.name==="ExperimentalWarning"&&/SQLite/i.test(c.message||""))&&b.call(process,a,c,...d)};let e=new(await Promise.resolve().then(c.t.bind(c,79868,23))).DatabaseSync(a);e.exec(d.oG);let f=new Map;function g(a){let b=f.get(a);return b||(b=e.prepare(a),f.set(a,b)),b}let h=setInterval(()=>{try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);function i(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{f.clear()}catch{}try{e.close()}catch{}}"function"==typeof h.unref&&h.unref();let j=()=>i();return process.once("beforeExit",j),process.once("SIGINT",()=>{j(),process.exit(0)}),process.once("SIGTERM",()=>{j(),process.exit(0)}),{driver:"node:sqlite",run(a,b=[]){let c=g(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>g(a).get(...b),all:(a,b=[])=>g(a).all(...b),exec:a=>e.exec(a),transaction(a){let b=`sp_${Math.random().toString(36).slice(2)}`;e.exec(`SAVEPOINT ${b}`);try{let c=a();return e.exec(`RELEASE ${b}`),c}catch(a){try{e.exec(`ROLLBACK TO ${b}`),e.exec(`RELEASE ${b}`)}catch{}throw a}},checkpoint(){try{e.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(h),i()},raw:e}}}};
@@ -1 +1 @@
1
- "use strict";exports.id=8590,exports.ids=[8590],exports.modules={3662:(a,b,c)=>{c.d(b,{EQ:()=>f,LY:()=>d,O:()=>e,fh:()=>h,t2:()=>i,wf:()=>g});let d={400:{type:"invalid_request_error",code:"bad_request"},401:{type:"authentication_error",code:"invalid_api_key"},402:{type:"billing_error",code:"payment_required"},403:{type:"permission_error",code:"insufficient_quota"},404:{type:"invalid_request_error",code:"model_not_found"},406:{type:"invalid_request_error",code:"model_not_supported"},429:{type:"rate_limit_error",code:"rate_limit_exceeded"},500:{type:"server_error",code:"internal_server_error"},502:{type:"server_error",code:"bad_gateway"},503:{type:"server_error",code:"service_unavailable"},504:{type:"server_error",code:"gateway_timeout"}},e={400:"Bad request",401:"Invalid API key provided",402:"Payment required",403:"You exceeded your current quota",404:"Model not found",406:"Model not supported",429:"Rate limit exceeded",500:"Internal server error",502:"Bad gateway - upstream provider error",503:"Service temporarily unavailable",504:"Gateway timeout"},f={base:2e3,max:3e5,maxLevel:15},g=3e4,h=18e5,i=[{text:"no credentials",cooldownMs:12e4},{text:"request not allowed",cooldownMs:5e3},{text:"improperly formed request",cooldownMs:12e4},{text:"rate limit",backoff:!0},{text:"too many requests",backoff:!0},{text:"quota exceeded",backoff:!0},{text:"capacity",backoff:!0},{text:"overloaded",backoff:!0},{status:401,cooldownMs:12e4},{status:402,cooldownMs:12e4},{status:403,cooldownMs:12e4},{status:404,cooldownMs:12e4},{status:429,backoff:!0}]},8590:(a,b,c)=>{c.d(b,{$B:()=>x,I9:()=>p,Og:()=>m,Ql:()=>t,Sc:()=>y,jR:()=>w,jT:()=>l,oD:()=>i,pb:()=>A,qZ:()=>B});var d=c(35024),e=c(75924),f=c(39609);let g=null;async function h(a,b){return a?k("xai",a,async()=>{try{g||(g=new(await Promise.all([c.e(3104),c.e(2030)]).then(c.bind(c,82030))).XaiService);let b=await g.refreshAccessToken(a);return{accessToken:b.access_token,refreshToken:b.refresh_token||a,expiresIn:b.expires_in,idToken:b.id_token}}catch(c){b?.warn?.("TOKEN_REFRESH",`xai refresh failed: ${c?.message||c}`);let a=String(c?.message||"");if(a.includes("invalid_grant")||a.includes("invalid_request"))return{error:"invalid_grant"};return null}},b):null}let i=3e5,j=new Map;async function k(a,b,c,d){if(!b)return c();let e=`${a}:${b}`,f=j.get(e);if(f){if(f.promise)return d?.info?.("TOKEN_REFRESH",`Reusing in-flight refresh for ${a}`),f.promise;if(f.expiresAt>Date.now())return d?.info?.("TOKEN_REFRESH",`Reusing recent refresh result for ${a}`),f.result;j.delete(e)}let g=(async()=>{try{let a=await c();return j.set(e,{result:a,expiresAt:Date.now()+1e4}),a}catch(a){throw j.delete(e),a}})();return j.set(e,{promise:g}),g}function l(a){return a&&"object"==typeof a&&("unrecoverable_refresh_error"===a.error||"refresh_token_reused"===a.error||"invalid_request"===a.error||"invalid_grant"===a.error)}function m(a){return e.Wu[a]||i}async function n(a,b,c,e){let f=d.xq[a];return f&&f.refreshUrl?b?k(a,b,async()=>{try{let c=await fetch(f.refreshUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:b,client_id:f.clientId,client_secret:f.clientSecret})});if(!c.ok){let b=await c.text();return e?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${a}`,{status:c.status,error:b}),null}let d=await c.json();return e?.info?.("TOKEN_REFRESH",`Successfully refreshed token for ${a}`,{hasNewAccessToken:!!d.access_token,hasNewRefreshToken:!!d.refresh_token,expiresIn:d.expires_in}),{accessToken:d.access_token,refreshToken:d.refresh_token||b,expiresIn:d.expires_in}}catch(b){return e?.error?.("TOKEN_REFRESH",`Error refreshing token for ${a}`,{error:b.message}),null}},e):(e?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null):(e?.warn?.("TOKEN_REFRESH",`No refresh URL configured for provider: ${a}`),null)}async function o(a,b){return a?k("claude",a,async()=>{try{let c=await fetch(e.NA.anthropic.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.claude.clientId})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Claude OAuth token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Claude OAuth token",{hasNewAccessToken:!!f.access_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Claude token: ${a.message}`),null}},b):null}async function p(a,b,c,d){return a?k(`google:${b}`,a,async()=>{try{let f=await fetch(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:b,client_secret:c})});if(!f.ok){let a=await f.text();return d?.error?.("TOKEN_REFRESH","Failed to refresh Google token",{status:f.status,error:a}),null}let g=await f.json();return d?.info?.("TOKEN_REFRESH","Successfully refreshed Google token",{hasNewAccessToken:!!g.access_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return d?.error?.("TOKEN_REFRESH",`Network error refreshing Google token: ${a.message}`),null}},d):null}async function q(a,b){return a?k("qwen",a,async()=>{let c=e.NA.qwen.token;try{let e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.qwen.clientId})});if(200===e.status){let c=await e.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Qwen token",{hasNewAccessToken:!!c.access_token,hasNewRefreshToken:!!c.refresh_token,expiresIn:c.expires_in}),{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,providerSpecificData:c.resource_url?{resourceUrl:c.resource_url}:void 0}}{let a=await e.text().catch(()=>"");b?.warn?.("TOKEN_REFRESH","Error with Qwen endpoint",{status:e.status,error:a})}}catch(a){b?.warn?.("TOKEN_REFRESH","Network error trying Qwen endpoint",{error:a.message})}return b?.error?.("TOKEN_REFRESH","Failed to refresh Qwen token"),null},b):null}async function r(a,b,c="codebuddy"){return a?k(c,a,async()=>{try{let e=d.xq[c]||d.xq.codebuddy,g=e.refreshUrl,h=e.domain||"www.codebuddy.ai",i=await (0,f.proxyAwareFetch)(g,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"CLI/2.63.2 CodeBuddy/2.63.2","X-Requested-With":"XMLHttpRequest","X-Domain":h,"X-Refresh-Token":a,"X-Auth-Refresh-Source":"plugin","X-Product":"SaaS"},body:"{}"});if(!i.ok)return b?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${c}`,{status:i.status,error:await i.text().catch(()=>"")}),null;let j=await i.json(),k=j?.data||j,l=k?.accessToken||k?.access_token;if(!l)return null;return{accessToken:l,refreshToken:k?.refreshToken||k?.refresh_token||a,expiresIn:k?.expiresIn||k?.expires_in||86400}}catch(a){return b?.error?.("TOKEN_REFRESH",`Error refreshing token for ${c}`,{error:a.message}),null}},b):null}async function s(a,b){return a?k("codex",a,async()=>{try{let c=await fetch(e.NA.openai.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({client_id:d.xq.codex.clientId,grant_type:"refresh_token",refresh_token:a})});if(!c.ok){let a=await c.text(),d=function(a="",b=0){let c=null;try{c=a?JSON.parse(a):null}catch{c=null}let d=c?.error?.code||c?.error||c?.error_code||"",e=c?.error_description||c?.message||a||"",f=`${d} ${e}`.toLowerCase();return{status:b,code:d,description:e,permanent:["refresh_token_expired","refresh_token_reused","refresh_token_invalidated","invalid_grant"].some(a=>f.includes(a))}}(a,c.status);if(d.permanent)return b?.error?.("TOKEN_REFRESH","Codex refresh token already used or invalid. Re-auth required.",{status:c.status,code:d.code}),{error:"unrecoverable_refresh_error",code:d.code};return b?.error?.("TOKEN_REFRESH","Failed to refresh Codex token",{status:c.status,error:a,code:d.code,permanent:d.permanent}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Codex token",{hasNewAccessToken:!!f.access_token,hasNewRefreshToken:!!f.refresh_token,hasIdToken:!!f.id_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,idToken:f.id_token,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Codex token: ${a.message}`),null}},b):null}async function t(a,b,c,e=null){return a?k("kiro",a,async()=>{let g=b?.authMethod,h=b?.clientId,i=b?.clientSecret,j=b?.region;if(h&&i){let b="idc"===g&&j?`https://oidc.${j}.amazonaws.com/token`:"https://oidc.us-east-1.amazonaws.com/token",d=await (0,f.proxyAwareFetch)(b,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:h,clientSecret:i,refreshToken:a,grantType:"refresh_token"})},e);if(!d.ok){let a=await d.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro AWS token",{status:d.status,error:a}),null}let k=await d.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro AWS token",{hasNewAccessToken:!!k.accessToken,expiresIn:k.expiresIn}),{accessToken:k.accessToken,refreshToken:k.refreshToken||a,expiresIn:k.expiresIn}}let k=await (0,f.proxyAwareFetch)(d.xq.kiro.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:a})},e);if(!k.ok){let a=await k.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro social token",{status:k.status,error:a}),null}let l=await k.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro social token",{hasNewAccessToken:!!l.accessToken,expiresIn:l.expiresIn}),{accessToken:l.accessToken,refreshToken:l.refreshToken||a,expiresIn:l.expiresIn}},c):null}async function u(a,b){return a?k("iflow",a,async()=>{let c=btoa(`${d.xq.iflow.clientId}:${d.xq.iflow.clientSecret}`),f=await fetch(e.NA.iflow.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${c}`},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.iflow.clientId,client_secret:d.xq.iflow.clientSecret})});if(!f.ok){let a=await f.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh iFlow token",{status:f.status,error:a}),null}let g=await f.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed iFlow token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}},b):null}async function v(a,b){return a?k("github",a,async()=>{let c={grant_type:"refresh_token",refresh_token:a,client_id:d.xq.github.clientId};d.xq.github.clientSecret&&(c.client_secret=d.xq.github.clientSecret);let f=await fetch(e.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(c)});if(!f.ok){let a=await f.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:f.status,error:a}),null}let g=await f.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}},b):null}async function w(a,b){return a?k("copilot",a,async()=>{try{let c=await fetch("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:`token ${a}`,"User-Agent":e.x0.USER_AGENT,"Editor-Version":`vscode/${e.x0.VSCODE_VERSION}`,"Editor-Plugin-Version":`copilot-chat/${e.x0.COPILOT_CHAT_VERSION}`,Accept:"application/json","x-github-api-version":e.x0.API_VERSION}});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Copilot token",{status:c.status,error:a}),null}let d=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!d.token,expiresAt:d.expires_at}),{token:d.token,expiresAt:d.expires_at}}catch(a){return b?.error?.("TOKEN_REFRESH","Error refreshing Copilot token",{error:a.message}),null}},b):null}async function x(a,b,c){if(!b.refreshToken)return null;switch(a){case"gemini-cli":case"antigravity":return p(b.refreshToken,d.xq[a].clientId,d.xq[a].clientSecret,c);case"claude":return o(b.refreshToken,c);case"codex":return s(b.refreshToken,c);case"qwen":return q(b.refreshToken,c);case"codebuddy":return r(b.refreshToken,c,"codebuddy");case"codebuddy-cn":return r(b.refreshToken,c,"codebuddy-cn");case"iflow":return u(b.refreshToken,c);case"github":return v(b.refreshToken,c);case"kiro":return t(b.refreshToken,b.providerSpecificData,c);case"xai":return h(b.refreshToken,c);case"vertex":case"vertex-partner":{let a=y(b.apiKey);if(!a)return null;return A(a,c)}default:return n(a,b.refreshToken,b,c)}}function y(a){if("string"!=typeof a)return null;try{let b=JSON.parse(a);if("service_account"===b.type&&b.client_email&&b.private_key&&b.project_id)return b;return null}catch{return null}}let z=new Map;async function A(a,b){let d=a.client_email,e=z.get(d);if(e&&e.expiresAt-Date.now()>3e5)return{accessToken:e.token,expiresAt:e.expiresAt};try{let{SignJWT:e,importPKCS8:f}=await Promise.all([c.e(6935),c.e(8971)]).then(c.bind(c,8971));b?.debug?.("TOKEN_REFRESH",`Vertex minting token for ${a.client_email}`);let g=await f(a.private_key.replace(/\\n/g,"\n"),"RS256"),h=Math.floor(Date.now()/1e3),i=await new e({scope:"https://www.googleapis.com/auth/cloud-platform"}).setProtectedHeader({alg:"RS256"}).setIssuer(a.client_email).setAudience("https://oauth2.googleapis.com/token").setIssuedAt(h).setExpirationTime(h+3600).sign(g),j=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i})});if(!j.ok){let a=await j.text();return b?.error?.("TOKEN_REFRESH",`Vertex token mint failed: ${a}`),null}let{access_token:k,expires_in:l}=await j.json(),m=Date.now()+(l??3600)*1e3;return z.set(d,{token:k,expiresAt:m}),b?.info?.("TOKEN_REFRESH",`Vertex token minted for ${a.client_email}`),{accessToken:k,expiresAt:m}}catch(a){return b?.error?.("TOKEN_REFRESH",`Vertex token error: ${a.message}`),null}}async function B(a,b=3,c=null){for(let d=0;d<b;d++){if(d>0){let a=1e3*d;c?.debug?.("TOKEN_REFRESH",`Retry ${d}/${b} after ${a}ms`),await new Promise(b=>setTimeout(b,a))}try{let b=await a();if(b)return b}catch(a){c?.warn?.("TOKEN_REFRESH",`Attempt ${d+1}/${b} failed: ${a.message}`)}}return c?.error?.("TOKEN_REFRESH",`All ${b} retry attempts failed`),null}},39609:(a,b,c)=>{c.d(b,{proxyAwareFetch:()=>q});var d=c(27910),e=c(41004);let f=globalThis.fetch,g=new Map,h=new Map,i=["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com","api2.cursor.sh"],j=["8.8.8.8","8.8.4.4"];function k(a){return null==a?"":String(a).trim()}async function l(a){let b=h.get(a);if(b&&Date.now()<b.expiry)return b.ip;try{let b=await Promise.resolve().then(c.t.bind(c,14985,23)),{promisify:d}=await Promise.resolve().then(c.t.bind(c,28354,23)),f=new b.Resolver;f.setServers(j);let g=d(f.resolve4.bind(f)),i=await g(a);return h.set(a,{ip:i[0],expiry:Date.now()+e.v1.dnsCacheTtlMs}),i[0]}catch(b){return console.warn(`[ProxyFetch] DNS resolve failed for ${a}:`,b.message),null}}function m(a,b){let c,d=k(b);if(!d)return!1;try{c=new URL(a).hostname.toLowerCase()}catch{return!1}return d.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean).some(a=>"*"===a||(a.startsWith(".")?c.endsWith(a)||c===a.slice(1):c===a||c.endsWith(`.${a}`)))}function n(a){let b=k(a);if(!b)return null;try{return new URL(b),b}catch{return`http://${b}`}}async function o(a){let b=n(a);if(!b)return null;if(!g.has(b)){g.size>=e.v1.proxyDispatchersMaxSize&&g.delete(g.keys().next().value);let{ProxyAgent:a}=await c.e(7774).then(c.t.bind(c,47774,19));g.set(b,new a({uri:b}))}return g.get(b)}async function p(a,b,e){let f=await Promise.resolve().then(c.t.bind(c,55591,23)),g=await Promise.resolve().then(c.t.bind(c,91645,23)),h=f.default??f,i=g.default??g;return new Promise((c,f)=>{let g=new i.Socket;g.connect(443,b,()=>{let b={socket:g,servername:a.hostname,path:a.pathname+a.search,method:e.method||"POST",headers:{...e.headers,Host:a.hostname}},i=h.request(b,a=>{let b={ok:a.statusCode>=200&&a.statusCode<300,status:a.statusCode,statusText:a.statusMessage,headers:new Map(Object.entries(a.headers)),body:d.Readable.toWeb(a),text:async()=>{let b=[];for await(let c of a)b.push(c);return Buffer.concat(b).toString()},json:async()=>JSON.parse(await b.text())};c(b)});i.on("error",f),e.body&&i.write("string"==typeof e.body?e.body:JSON.stringify(e.body)),i.end()}),g.on("error",f)})}async function q(a,b={},c=null){let d="string"==typeof a?a:a.toString(),e=k(c?.vercelRelayUrl);if(e){let a=new URL(d),c={...b.headers,"x-relay-target":`${a.protocol}//${a.host}`,"x-relay-path":`${a.pathname}${a.search}`};return f(e,{...b,headers:c})}let g=function(a,b){if(b?.enabled!==!0&&b?.connectionProxyEnabled!==!0)return null;let c=k(b?.url??b?.connectionProxyUrl);if(!c)return null;let d=k(b?.noProxy??b?.connectionNoProxy);return d&&m(a,d)?null:n(c)}(d,c),h=g?null:n(function(a){let b;if(m(a,process.env.NO_PROXY||process.env.no_proxy))return null;try{b=new URL(a).protocol}catch{return null}return"https:"===b?process.env.HTTPS_PROXY||process.env.https_proxy||process.env.ALL_PROXY||process.env.all_proxy:process.env.HTTP_PROXY||process.env.http_proxy||process.env.ALL_PROXY||process.env.all_proxy}(d)),j=g||h;if(function(a){try{let b=new URL(a).hostname;return i.some(a=>b.includes(a))}catch{return!1}}(d)){if(j)try{let c=await o(j);return await f(a,{...b,dispatcher:c})}catch(a){if(c?.strictProxy===!0)throw Error(`[ProxyFetch] Proxy required but failed (strictProxy=true): ${a.message}`);console.warn(`[ProxyFetch] Proxy failed, falling back to direct bypass: ${a.message}`)}try{let a=new URL(d),c=await l(a.hostname);if(c)return await p(a,c,b)}catch(a){console.warn(`[ProxyFetch] MITM bypass failed: ${a.message}`)}}if(j)try{let c=await o(j);return await f(a,{...b,dispatcher:c})}catch(a){if(c?.strictProxy===!0)throw Error(`[ProxyFetch] Proxy required but failed (strictProxy=true): ${a.message}`);console.warn(`[ProxyFetch] Proxy failed, falling back to direct: ${a.message}`)}return f(a,b)}async function r(a,b={}){return q(a,b,null)}globalThis.fetch!==r&&(globalThis.fetch=r)},41004:(a,b,c)=>{c.d(b,{C8:()=>l,DR:()=>k,Uc:()=>h,cI:()=>j,eo:()=>i,gx:()=>d,pH:()=>g,v1:()=>e,xM:()=>f}),c(3662);let d={BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,NOT_ACCEPTABLE:406,REQUEST_TIMEOUT:408,RATE_LIMITED:429,SERVER_ERROR:500,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504},e={sessionTtlMs:72e5,sessionCleanupIntervalMs:18e5,dnsCacheTtlMs:3e5,proxyDispatchersMaxSize:20},f=6e4,g=6e4,h=64e3,i=32e3,j={429:{attempts:0,delayMs:0},502:{attempts:3,delayMs:3e3},503:{attempts:3,delayMs:2e3},504:{attempts:2,delayMs:3e3}};function k(a){return null==a?{attempts:0,delayMs:2e3}:"number"==typeof a?{attempts:a,delayMs:2e3}:{attempts:a.attempts||0,delayMs:null!=a.delayMs?a.delayMs:2e3}}let l=["Please write a 5-10 word title for the following conversation:"]},75924:(a,b,c)=>{c.d(b,{$V:()=>t,A9:()=>i,Cn:()=>j,Co:()=>s,Ic:()=>q,J5:()=>n,K:()=>o,NA:()=>v,Ox:()=>k,QH:()=>l,VK:()=>w,Wu:()=>u,go:()=>e,nZ:()=>p,sX:()=>f,uR:()=>m,x0:()=>g,zv:()=>r});var d=c(21820);let e="google-genai-sdk/1.41.0 gl-node/v22.19.0";function f(a="unknown"){let b;return`GeminiCLI/0.34.0/${a||"unknown"} (${(0,d.platform)()}; ${"ia32"===(b=(0,d.arch)())?"x86":b}; terminal)`}let g={VSCODE_VERSION:"1.110.0",COPILOT_CHAT_VERSION:"0.38.0",USER_AGENT:"GitHubCopilotChat/0.38.0",API_VERSION:"2025-04-01"};function h(){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)}function i(){return`antigravity/1.104.0 ${(0,d.platform)()}/${(0,d.arch)()}`}let j={ideType:9,platform:h(),pluginType:2},k={name:"x-request-source",value:"local"},l="_ide",m="_ide",n=new Set(["browser_subagent","command_status","find_by_name","generate_image","grep_search","list_dir","list_resources","multi_replace_file_content","notify_user","read_resource","read_terminal","read_url_content","replace_file_content","run_command","search_web","send_command_input","task_boundary","view_content_chunk","view_file","write_to_file"]),o={"User-Agent":`antigravity/1.107.0 ${(0,d.platform)()}/${(0,d.arch)()}`},p={loadCodeAssist:"https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist",onboardUser:"https://cloudcode-pa.googleapis.com/v1internal:onboardUser"},q={"Content-Type":"application/json","User-Agent":"google-api-nodejs-client/9.15.1","X-Goog-Api-Client":"google-cloud-sdk vscode_cloudshelleditor/0.1","Client-Metadata":JSON.stringify({ideType:9,platform:h(),pluginType:2})},r={ideType:9,platform:h(),pluginType:2},s="You are Claude Code, Anthropic's official CLI for Claude.",t="You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.**Absolute paths only****Proactiveness**",u={codex:432e6,claude:144e5,iflow:864e5,qwen:12e5,codebuddy:12e5,"kimi-coding":3e5,antigravity:3e5},v={google:{token:"https://oauth2.googleapis.com/token",auth:"https://accounts.google.com/o/oauth2/auth"},openai:{token:"https://auth.openai.com/oauth/token",auth:"https://auth.openai.com/oauth/authorize"},anthropic:{token:"https://api.anthropic.com/v1/oauth/token",auth:"https://api.anthropic.com/v1/oauth/authorize"},qwen:{token:"https://qwen.ai/api/v1/oauth2/token",auth:"https://qwen.ai/api/v1/oauth2/device/code"},iflow:{token:"https://iflow.cn/oauth/token",auth:"https://iflow.cn/oauth"},github:{token:"https://github.com/login/oauth/access_token",auth:"https://github.com/login/oauth/authorize",deviceCode:"https://github.com/login/device/code"}};function w(){return{"X-Msh-Platform":"9router","X-Msh-Version":"2.1.2","X-Msh-Device-Model":"u">typeof process?`${process.platform} ${process.arch}`:"unknown","X-Msh-Device-Id":`kimi-${Date.now()}`}}}};
1
+ "use strict";exports.id=8590,exports.ids=[8590],exports.modules={3662:(a,b,c)=>{c.d(b,{EQ:()=>f,LY:()=>d,O:()=>e,fh:()=>h,t2:()=>i,wf:()=>g});let d={400:{type:"invalid_request_error",code:"bad_request"},401:{type:"authentication_error",code:"invalid_api_key"},402:{type:"billing_error",code:"payment_required"},403:{type:"permission_error",code:"insufficient_quota"},404:{type:"invalid_request_error",code:"model_not_found"},406:{type:"invalid_request_error",code:"model_not_supported"},429:{type:"rate_limit_error",code:"rate_limit_exceeded"},500:{type:"server_error",code:"internal_server_error"},502:{type:"server_error",code:"bad_gateway"},503:{type:"server_error",code:"service_unavailable"},504:{type:"server_error",code:"gateway_timeout"}},e={400:"Bad request",401:"Invalid API key provided",402:"Payment required",403:"You exceeded your current quota",404:"Model not found",406:"Model not supported",429:"Rate limit exceeded",500:"Internal server error",502:"Bad gateway - upstream provider error",503:"Service temporarily unavailable",504:"Gateway timeout"},f={base:2e3,max:3e5,maxLevel:15},g=3e4,h=18e5,i=[{text:"no credentials",cooldownMs:12e4},{text:"request not allowed",cooldownMs:5e3},{text:"improperly formed request",cooldownMs:12e4},{text:"rate limit",backoff:!0},{text:"too many requests",backoff:!0},{text:"quota exceeded",backoff:!0},{text:"capacity",backoff:!0},{text:"overloaded",backoff:!0},{status:401,cooldownMs:12e4},{status:402,cooldownMs:12e4},{status:403,cooldownMs:12e4},{status:404,cooldownMs:12e4},{status:429,backoff:!0}]},8590:(a,b,c)=>{c.d(b,{$B:()=>x,I9:()=>p,Og:()=>m,Ql:()=>t,Sc:()=>y,jR:()=>w,jT:()=>l,oD:()=>i,pb:()=>A,qZ:()=>B});var d=c(35024),e=c(75924),f=c(39609);let g=null;async function h(a,b){return a?k("xai",a,async()=>{try{g||(g=new(await Promise.all([c.e(3104),c.e(2030)]).then(c.bind(c,82030))).XaiService);let b=await g.refreshAccessToken(a);return{accessToken:b.access_token,refreshToken:b.refresh_token||a,expiresIn:b.expires_in,idToken:b.id_token}}catch(c){b?.warn?.("TOKEN_REFRESH",`xai refresh failed: ${c?.message||c}`);let a=String(c?.message||"");if(a.includes("invalid_grant")||a.includes("invalid_request"))return{error:"invalid_grant"};return null}},b):null}let i=3e5,j=new Map;async function k(a,b,c,d){if(!b)return c();let e=`${a}:${b}`,f=j.get(e);if(f){if(f.promise)return d?.info?.("TOKEN_REFRESH",`Reusing in-flight refresh for ${a}`),f.promise;if(f.expiresAt>Date.now())return d?.info?.("TOKEN_REFRESH",`Reusing recent refresh result for ${a}`),f.result;j.delete(e)}let g=(async()=>{try{let a=await c();return j.set(e,{result:a,expiresAt:Date.now()+1e4}),a}catch(a){throw j.delete(e),a}})();return j.set(e,{promise:g}),g}function l(a){return a&&"object"==typeof a&&("unrecoverable_refresh_error"===a.error||"refresh_token_reused"===a.error||"invalid_request"===a.error||"invalid_grant"===a.error)}function m(a){return e.Wu[a]||i}async function n(a,b,c,e){let f=d.xq[a];return f&&f.refreshUrl?b?k(a,b,async()=>{try{let c=await fetch(f.refreshUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:b,client_id:f.clientId,client_secret:f.clientSecret})});if(!c.ok){let b=await c.text();return e?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${a}`,{status:c.status,error:b}),null}let d=await c.json();return e?.info?.("TOKEN_REFRESH",`Successfully refreshed token for ${a}`,{hasNewAccessToken:!!d.access_token,hasNewRefreshToken:!!d.refresh_token,expiresIn:d.expires_in}),{accessToken:d.access_token,refreshToken:d.refresh_token||b,expiresIn:d.expires_in}}catch(b){return e?.error?.("TOKEN_REFRESH",`Error refreshing token for ${a}`,{error:b.message}),null}},e):(e?.warn?.("TOKEN_REFRESH",`No refresh token available for provider: ${a}`),null):(e?.warn?.("TOKEN_REFRESH",`No refresh URL configured for provider: ${a}`),null)}async function o(a,b){return a?k("claude",a,async()=>{try{let c=await fetch(e.NA.anthropic.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.claude.clientId})});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Claude OAuth token",{status:c.status,error:a}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Claude OAuth token",{hasNewAccessToken:!!f.access_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Claude token: ${a.message}`),null}},b):null}async function p(a,b,c,d){return a?k(`google:${b}`,a,async()=>{try{let f=await fetch(e.NA.google.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:b,client_secret:c})});if(!f.ok){let a=await f.text();return d?.error?.("TOKEN_REFRESH","Failed to refresh Google token",{status:f.status,error:a}),null}let g=await f.json();return d?.info?.("TOKEN_REFRESH","Successfully refreshed Google token",{hasNewAccessToken:!!g.access_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}}catch(a){return d?.error?.("TOKEN_REFRESH",`Network error refreshing Google token: ${a.message}`),null}},d):null}async function q(a,b){return a?k("qwen",a,async()=>{let c=e.NA.qwen.token;try{let e=await fetch(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.qwen.clientId})});if(200===e.status){let c=await e.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Qwen token",{hasNewAccessToken:!!c.access_token,hasNewRefreshToken:!!c.refresh_token,expiresIn:c.expires_in}),{accessToken:c.access_token,refreshToken:c.refresh_token||a,expiresIn:c.expires_in,providerSpecificData:c.resource_url?{resourceUrl:c.resource_url}:void 0}}{let a=await e.text().catch(()=>"");b?.warn?.("TOKEN_REFRESH","Error with Qwen endpoint",{status:e.status,error:a})}}catch(a){b?.warn?.("TOKEN_REFRESH","Network error trying Qwen endpoint",{error:a.message})}return b?.error?.("TOKEN_REFRESH","Failed to refresh Qwen token"),null},b):null}async function r(a,b,c="codebuddy"){return a?k(c,a,async()=>{try{let e=d.xq[c]||d.xq.codebuddy,g=e.refreshUrl,h=e.domain||"www.codebuddy.ai",i=await (0,f.proxyAwareFetch)(g,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"CLI/2.63.2 CodeBuddy/2.63.2","X-Requested-With":"XMLHttpRequest","X-Domain":h,"X-Refresh-Token":a,"X-Auth-Refresh-Source":"plugin","X-Product":"SaaS"},body:"{}"});if(!i.ok)return b?.error?.("TOKEN_REFRESH",`Failed to refresh token for ${c}`,{status:i.status,error:await i.text().catch(()=>"")}),null;let j=await i.json(),k=j?.data||j,l=k?.accessToken||k?.access_token;if(!l)return null;return{accessToken:l,refreshToken:k?.refreshToken||k?.refresh_token||a,expiresIn:k?.expiresIn||k?.expires_in||86400}}catch(a){return b?.error?.("TOKEN_REFRESH",`Error refreshing token for ${c}`,{error:a.message}),null}},b):null}async function s(a,b){return a?k("codex",a,async()=>{try{let c=await fetch(e.NA.openai.token,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({client_id:d.xq.codex.clientId,grant_type:"refresh_token",refresh_token:a})});if(!c.ok){let a=await c.text(),d=function(a="",b=0){let c=null;try{c=a?JSON.parse(a):null}catch{c=null}let d=c?.error?.code||c?.error||c?.error_code||"",e=c?.error_description||c?.message||a||"",f=`${d} ${e}`.toLowerCase();return{status:b,code:d,description:e,permanent:["refresh_token_expired","refresh_token_reused","refresh_token_invalidated","invalid_grant"].some(a=>f.includes(a))}}(a,c.status);if(d.permanent)return b?.error?.("TOKEN_REFRESH","Codex refresh token already used or invalid. Re-auth required.",{status:c.status,code:d.code}),{error:"unrecoverable_refresh_error",code:d.code};return b?.error?.("TOKEN_REFRESH","Failed to refresh Codex token",{status:c.status,error:a,code:d.code,permanent:d.permanent}),null}let f=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Codex token",{hasNewAccessToken:!!f.access_token,hasNewRefreshToken:!!f.refresh_token,hasIdToken:!!f.id_token,expiresIn:f.expires_in}),{accessToken:f.access_token,refreshToken:f.refresh_token||a,idToken:f.id_token,expiresIn:f.expires_in}}catch(a){return b?.error?.("TOKEN_REFRESH",`Network error refreshing Codex token: ${a.message}`),null}},b):null}async function t(a,b,c,e=null){return a?k("kiro",a,async()=>{let g=b?.authMethod,h=b?.clientId,i=b?.clientSecret,j=b?.region;if(h&&i){let b="idc"===g&&j?`https://oidc.${j}.amazonaws.com/token`:"https://oidc.us-east-1.amazonaws.com/token",d=await (0,f.proxyAwareFetch)(b,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({clientId:h,clientSecret:i,refreshToken:a,grantType:"refresh_token"})},e);if(!d.ok){let a=await d.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro AWS token",{status:d.status,error:a}),null}let k=await d.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro AWS token",{hasNewAccessToken:!!k.accessToken,expiresIn:k.expiresIn}),{accessToken:k.accessToken,refreshToken:k.refreshToken||a,expiresIn:k.expiresIn}}let k=await (0,f.proxyAwareFetch)(d.xq.kiro.tokenUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":"kiro-cli/1.0.0"},body:JSON.stringify({refreshToken:a})},e);if(!k.ok){let a=await k.text();return c?.error?.("TOKEN_REFRESH","Failed to refresh Kiro social token",{status:k.status,error:a}),null}let l=await k.json();return c?.info?.("TOKEN_REFRESH","Successfully refreshed Kiro social token",{hasNewAccessToken:!!l.accessToken,expiresIn:l.expiresIn}),{accessToken:l.accessToken,refreshToken:l.refreshToken||a,expiresIn:l.expiresIn}},c):null}async function u(a,b){return a?k("iflow",a,async()=>{let c=btoa(`${d.xq.iflow.clientId}:${d.xq.iflow.clientSecret}`),f=await fetch(e.NA.iflow.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json",Authorization:`Basic ${c}`},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:a,client_id:d.xq.iflow.clientId,client_secret:d.xq.iflow.clientSecret})});if(!f.ok){let a=await f.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh iFlow token",{status:f.status,error:a}),null}let g=await f.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed iFlow token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}},b):null}async function v(a,b){return a?k("github",a,async()=>{let c={grant_type:"refresh_token",refresh_token:a,client_id:d.xq.github.clientId};d.xq.github.clientSecret&&(c.client_secret=d.xq.github.clientSecret);let f=await fetch(e.NA.github.token,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(c)});if(!f.ok){let a=await f.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh GitHub token",{status:f.status,error:a}),null}let g=await f.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed GitHub token",{hasNewAccessToken:!!g.access_token,hasNewRefreshToken:!!g.refresh_token,expiresIn:g.expires_in}),{accessToken:g.access_token,refreshToken:g.refresh_token||a,expiresIn:g.expires_in}},b):null}async function w(a,b){return a?k("copilot",a,async()=>{try{let c=await fetch("https://api.github.com/copilot_internal/v2/token",{headers:{Authorization:`token ${a}`,"User-Agent":e.x0.USER_AGENT,"Editor-Version":`vscode/${e.x0.VSCODE_VERSION}`,"Editor-Plugin-Version":`copilot-chat/${e.x0.COPILOT_CHAT_VERSION}`,Accept:"application/json","x-github-api-version":e.x0.API_VERSION}});if(!c.ok){let a=await c.text();return b?.error?.("TOKEN_REFRESH","Failed to refresh Copilot token",{status:c.status,error:a}),null}let d=await c.json();return b?.info?.("TOKEN_REFRESH","Successfully refreshed Copilot token",{hasToken:!!d.token,expiresAt:d.expires_at}),{token:d.token,expiresAt:d.expires_at}}catch(a){return b?.error?.("TOKEN_REFRESH","Error refreshing Copilot token",{error:a.message}),null}},b):null}async function x(a,b,c){if(!b.refreshToken)return null;switch(a){case"gemini-cli":case"antigravity":return p(b.refreshToken,d.xq[a].clientId,d.xq[a].clientSecret,c);case"claude":return o(b.refreshToken,c);case"codex":return s(b.refreshToken,c);case"qwen":return q(b.refreshToken,c);case"codebuddy":return r(b.refreshToken,c,"codebuddy");case"codebuddy-cn":return r(b.refreshToken,c,"codebuddy-cn");case"iflow":return u(b.refreshToken,c);case"github":return v(b.refreshToken,c);case"kiro":return t(b.refreshToken,b.providerSpecificData,c);case"xai":return h(b.refreshToken,c);case"vertex":case"vertex-partner":{let a=y(b.apiKey);if(!a)return null;return A(a,c)}default:return n(a,b.refreshToken,b,c)}}function y(a){if("string"!=typeof a)return null;try{let b=JSON.parse(a);if("service_account"===b.type&&b.client_email&&b.private_key&&b.project_id)return b;return null}catch{return null}}let z=new Map;async function A(a,b){let d=a.client_email,e=z.get(d);if(e&&e.expiresAt-Date.now()>3e5)return{accessToken:e.token,expiresAt:e.expiresAt};try{let{SignJWT:e,importPKCS8:f}=await Promise.all([c.e(6935),c.e(8971)]).then(c.bind(c,8971));b?.debug?.("TOKEN_REFRESH",`Vertex minting token for ${a.client_email}`);let g=await f(a.private_key.replace(/\\n/g,"\n"),"RS256"),h=Math.floor(Date.now()/1e3),i=await new e({scope:"https://www.googleapis.com/auth/cloud-platform"}).setProtectedHeader({alg:"RS256"}).setIssuer(a.client_email).setAudience("https://oauth2.googleapis.com/token").setIssuedAt(h).setExpirationTime(h+3600).sign(g),j=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i})});if(!j.ok){let a=await j.text();return b?.error?.("TOKEN_REFRESH",`Vertex token mint failed: ${a}`),null}let{access_token:k,expires_in:l}=await j.json(),m=Date.now()+(l??3600)*1e3;return z.set(d,{token:k,expiresAt:m}),b?.info?.("TOKEN_REFRESH",`Vertex token minted for ${a.client_email}`),{accessToken:k,expiresAt:m}}catch(a){return b?.error?.("TOKEN_REFRESH",`Vertex token error: ${a.message}`),null}}async function B(a,b=3,c=null){for(let d=0;d<b;d++){if(d>0){let a=1e3*d;c?.debug?.("TOKEN_REFRESH",`Retry ${d}/${b} after ${a}ms`),await new Promise(b=>setTimeout(b,a))}try{let b=await a();if(b)return b}catch(a){c?.warn?.("TOKEN_REFRESH",`Attempt ${d+1}/${b} failed: ${a.message}`)}}return c?.error?.("TOKEN_REFRESH",`All ${b} retry attempts failed`),null}},39609:(a,b,c)=>{c.d(b,{proxyAwareFetch:()=>q});var d=c(27910),e=c(41004);let f=globalThis.fetch,g=new Map,h=new Map,i=["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com","api2.cursor.sh"],j=["8.8.8.8","8.8.4.4"];function k(a){return null==a?"":String(a).trim()}async function l(a){let b=h.get(a);if(b&&Date.now()<b.expiry)return b.ip;try{let b=await Promise.resolve().then(c.t.bind(c,14985,23)),{promisify:d}=await Promise.resolve().then(c.t.bind(c,28354,23)),f=new b.Resolver;f.setServers(j);let g=d(f.resolve4.bind(f)),i=await g(a);return h.set(a,{ip:i[0],expiry:Date.now()+e.v1.dnsCacheTtlMs}),i[0]}catch(b){return console.warn(`[ProxyFetch] DNS resolve failed for ${a}:`,b.message),null}}function m(a,b){let c,d=k(b);if(!d)return!1;try{c=new URL(a).hostname.toLowerCase()}catch{return!1}return d.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean).some(a=>"*"===a||(a.startsWith(".")?c.endsWith(a)||c===a.slice(1):c===a||c.endsWith(`.${a}`)))}function n(a){let b=k(a);if(!b)return null;try{return new URL(b),b}catch{return`http://${b}`}}async function o(a){let b=n(a);if(!b)return null;if(!g.has(b)){g.size>=e.v1.proxyDispatchersMaxSize&&g.delete(g.keys().next().value);let{ProxyAgent:a}=await c.e(7774).then(c.t.bind(c,47774,19));g.set(b,new a({uri:b}))}return g.get(b)}async function p(a,b,e){let f=await Promise.resolve().then(c.t.bind(c,55591,23)),g=await Promise.resolve().then(c.t.bind(c,91645,23)),h=f.default??f,i=g.default??g;return new Promise((c,f)=>{let g=new i.Socket;g.connect(443,b,()=>{let b={socket:g,servername:a.hostname,path:a.pathname+a.search,method:e.method||"POST",headers:{...e.headers,Host:a.hostname}},i=h.request(b,a=>{let b={ok:a.statusCode>=200&&a.statusCode<300,status:a.statusCode,statusText:a.statusMessage,headers:new Map(Object.entries(a.headers)),body:d.Readable.toWeb(a),text:async()=>{let b=[];for await(let c of a)b.push(c);return Buffer.concat(b).toString()},json:async()=>JSON.parse(await b.text())};c(b)});i.on("error",f),e.body&&i.write("string"==typeof e.body?e.body:JSON.stringify(e.body)),i.end()}),g.on("error",f)})}async function q(a,b={},c=null){let d="string"==typeof a?a:a.toString(),e=k(c?.vercelRelayUrl);if(e){let a=new URL(d),c={...b.headers,"x-relay-target":`${a.protocol}//${a.host}`,"x-relay-path":`${a.pathname}${a.search}`};return f(e,{...b,headers:c})}let g=function(a,b){if(b?.enabled!==!0&&b?.connectionProxyEnabled!==!0)return null;let c=k(b?.url??b?.connectionProxyUrl);if(!c)return null;let d=k(b?.noProxy??b?.connectionNoProxy);return d&&m(a,d)?null:n(c)}(d,c),h=g?null:n(function(a){let b;if(m(a,process.env.NO_PROXY||process.env.no_proxy))return null;try{b=new URL(a).protocol}catch{return null}return"https:"===b?process.env.HTTPS_PROXY||process.env.https_proxy||process.env.ALL_PROXY||process.env.all_proxy:process.env.HTTP_PROXY||process.env.http_proxy||process.env.ALL_PROXY||process.env.all_proxy}(d)),j=g||h;if(function(a){try{let b=new URL(a).hostname;return i.some(a=>b.includes(a))}catch{return!1}}(d)){if(j)try{let c=await o(j);return await f(a,{...b,dispatcher:c})}catch(a){if(c?.strictProxy===!0)throw Error(`[ProxyFetch] Proxy required but failed (strictProxy=true): ${a.message}`);console.warn(`[ProxyFetch] Proxy failed, falling back to direct bypass: ${a.message}`)}try{let a=new URL(d),c=await l(a.hostname);if(c)return await p(a,c,b)}catch(a){console.warn(`[ProxyFetch] MITM bypass failed: ${a.message}`)}}if(j)try{let c=await o(j);return await f(a,{...b,dispatcher:c})}catch(a){if(c?.strictProxy===!0)throw Error(`[ProxyFetch] Proxy required but failed (strictProxy=true): ${a.message}`);console.warn(`[ProxyFetch] Proxy failed, falling back to direct: ${a.message}`)}return f(a,b)}async function r(a,b={}){return q(a,b,null)}globalThis.fetch!==r&&(globalThis.fetch=r)},41004:(a,b,c)=>{c.d(b,{C8:()=>l,DR:()=>k,Uc:()=>h,cI:()=>j,eo:()=>i,gx:()=>d,pH:()=>g,v1:()=>e,xM:()=>f}),c(3662);let d={BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,NOT_ACCEPTABLE:406,REQUEST_TIMEOUT:408,RATE_LIMITED:429,SERVER_ERROR:500,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504},e={sessionTtlMs:72e5,sessionCleanupIntervalMs:18e5,dnsCacheTtlMs:3e5,proxyDispatchersMaxSize:20},f=6e4,g=6e4,h=64e3,i=32e3,j={429:{attempts:0,delayMs:0},502:{attempts:3,delayMs:3e3},503:{attempts:3,delayMs:2e3},504:{attempts:2,delayMs:3e3}};function k(a){return null==a?{attempts:0,delayMs:2e3}:"number"==typeof a?{attempts:a,delayMs:2e3}:{attempts:a.attempts||0,delayMs:null!=a.delayMs?a.delayMs:2e3}}let l=["Please write a 5-10 word title for the following conversation:"]}};
@@ -1 +1 @@
1
- "use strict";exports.id=891,exports.ids=[891],exports.modules={40891:(a,b,c)=>{c.d(b,{cO:()=>d.cO,Ol:()=>D,L_:()=>d.$w});var d=c(33342),e=c(92130),f=c(82506);let g="codebuddy",h="CodeBuddy",i=new Set(["codebuddy.ai","www.codebuddy.ai"]),j="personal-edition-user-id";function k(a){return new Promise(b=>setTimeout(b,a))}async function l({tokens:a,email:b}){let{createProviderConnection:d}=await Promise.resolve().then(c.bind(c,71998)),e={...a.providerSpecificData||{},loginEmail:b,automation:"gsuite-bulk"};a.webCookie&&(e.webCookie=a.webCookie,e.webCookieCapturedAt=a.webCookieCapturedAt||new Date().toISOString()),a.generatedApiKey&&(e.codebuddyApiKeyId=a.generatedApiKey.id||null,e.codebuddyApiKeyName=a.generatedApiKey.name||null,e.codebuddyApiKeyExpiresAt=a.generatedApiKey.expiresAt||null,e.authMode="generated-api-key");let f={provider:g,authType:"oauth",...a,email:b,providerSpecificData:e,expiresAt:a.expiresIn?new Date(Date.now()+1e3*a.expiresIn).toISOString():null,testStatus:"active"},h=a.generatedApiKey?.key||a.apiKey;return h&&(f.apiKey=h),{connection:await d(f)}}async function m(a){let{requestDeviceCode:b}=await Promise.all([c.e(5433),c.e(4404),c.e(8590),c.e(3110),c.e(318),c.e(8895),c.e(4177),c.e(1322)]).then(c.bind(c,74177));return b(a)}async function n(a,b){let{pollForToken:d}=await Promise.all([c.e(5433),c.e(4404),c.e(8590),c.e(3110),c.e(318),c.e(8895),c.e(4177),c.e(1322)]).then(c.bind(c,74177));return d(a,b)}async function o(a,b,c="www.codebuddy.ai"){if(!a||!b)return null;try{let d=await fetch(`https://${c}/v2/plugin/login/account?state=${encodeURIComponent(b)}`,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","X-Domain":c}});if(!d.ok)return null;let e=await d.json(),f=e?.data||e||{};if(!f||"object"!=typeof f)return null;return{uid:f.uid||null,nickname:f.nickname||null,email:f.email||null,enterpriseId:f.enterpriseId||null,enterpriseName:f.enterpriseName||null,rawAuth:f}}catch{return null}}async function p(a){if(!a)return null;try{let{getProviderConnections:b}=await Promise.resolve().then(c.bind(c,71998)),d=(await b({provider:g})).find(b=>"oauth"===b.authType&&b.email===a&&b.apiKey);return d?.apiKey||null}catch{return null}}async function q(a){if(!a?.cookies)return console.warn("[CodeBuddy] captureWebCookie: context.cookies not available"),null;try{let b=await a.cookies(["https://www.codebuddy.ai","https://codebuddy.ai"]);console.log(`[CodeBuddy] captureWebCookie: found ${b.length} raw cookies from browser context`);let c=b.filter(a=>{let b=String(a.domain||"").replace(/^\./,"").toLowerCase();return i.has(b)||b.endsWith(".codebuddy.ai")}).filter(a=>a.name&&a.value).sort((a,b)=>String(a.name).localeCompare(String(b.name)));if(0===c.length)return console.warn("[CodeBuddy] captureWebCookie: no useful cookies after filtering. Raw cookie names:",b.map(a=>`${a.name}@${a.domain}`).join(", ")),null;let d=c.map(a=>`${a.name}=${a.value}`).join("; ");return console.log(`[CodeBuddy] captureWebCookie: captured ${c.length} cookies (${d.length} chars). Names: ${c.map(a=>a.name).join(", ")}`),d}catch(a){return console.error("[CodeBuddy] captureWebCookie error:",a.message),null}}async function r(a,b={}){let c=await q(a);return c?{...b,webCookie:c,webCookieCapturedAt:new Date().toISOString()}:b}async function s(a,b,{method:c="POST",headers:d={},referrer:e,body:f}={}){return a.evaluate(async({url:a,method:b,headers:c,referrer:d,body:e})=>{let f=await fetch(a,{method:b,credentials:"include",headers:c,referrer:d,body:null==e?null:JSON.stringify(e)}),g=await f.text().catch(()=>""),h=null;try{h=g?JSON.parse(g):null}catch{h={raw:g}}return{ok:f.ok,status:f.status,payload:h,text:g}},{url:b,method:c,headers:d,referrer:e,body:f})}async function t(a,b){b?.("submitting_codebuddy_region_profile","Submitting CodeBuddy region profile via account API");let c=await s(a,"https://www.codebuddy.ai/console/login/account",{method:"POST",headers:{accept:"application/json, text/plain, */*","content-type":"application/json","x-requested-with":"XMLHttpRequest","x-domain":"www.codebuddy.ai"},referrer:"https://www.codebuddy.ai/register/user/complete",body:{attributes:{countryCode:["62"],countryFullName:["Indonesia"],countryName:["ID"]}}});return c.ok&&(c.payload?.code===0||c.payload?.code===200||void 0===c.payload?.code)?{ok:!0,code:c.payload?.code??0,message:c.payload?.msg||c.payload?.message||"OK"}:{ok:!1,code:c.payload?.code??c.status,message:c.payload?.msg||c.payload?.message||c.text||`HTTP ${c.status}`}}async function u(a,b){b?.("activating_codebuddy_trial","Applying or verifying CodeBuddy IDE trial");let c=()=>s(a,"https://www.codebuddy.ai/billing/ide/trial",{method:"POST",headers:{accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","x-domain":"www.codebuddy.ai"},referrer:"https://www.codebuddy.ai/profile/plan",body:null}),d=await c(),e=d?.payload?.code;if(d.ok&&14051===e)return{ok:!0,code:e,state:"already_applied",message:d.payload?.msg||"has applied trial"};if(d.ok&&(0===e||200===e||void 0===e)){await k(1200);let a=await c(),b=a?.payload?.code;return a.ok&&(0===b||200===b||14051===b||void 0===b)?{ok:!0,code:b??e??0,state:14051===b?"applied_confirmed":"applied",message:a.payload?.msg||d.payload?.msg||"OK"}:{ok:!1,code:b??a.status,message:a.payload?.msg||a.payload?.message||a.text||`HTTP ${a.status}`}}return{ok:!1,code:e??d.status,message:d.payload?.msg||d.payload?.message||d.text||`HTTP ${d.status}`}}async function v(a,b,c=45e3){let d=Date.now(),e=null;for(;Date.now()-d<c;){let c=await a.evaluate(async()=>{try{let a=await fetch("/console/accounts",{method:"GET",credentials:"include",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json","x-requested-with":"XMLHttpRequest","X-Domain":window.location.hostname||"www.codebuddy.ai"}}),b=await a.text(),c=null;try{c=b?JSON.parse(b):null}catch{c=null}let d=c?.data?.accounts||c?.accounts||[];return{ok:a.ok,status:a.status,payload:c,accounts:d}}catch(a){return{ok:!1,status:0,error:a?.message||String(a)}}});if(c?.ok&&Array.isArray(c.accounts)&&c.accounts.length>0){let a=c.accounts.find(a=>a?.lastLogin)||c.accounts[0]||{};return{account:a,userEnterpriseId:a.type&&"personal"!==a.type&&a.enterpriseId?a.enterpriseId:j}}e=c?.error||`status=${c?.status||"unknown"}`,b?.("waiting_codebuddy_key_session",`Waiting for CodeBuddy web console session (${e})`),await a.waitForTimeout(1500)}let f=Error(`CodeBuddy key session invalid: ${e||"no account session"}`);throw f.step="key_session_invalid",f.status="needs_manual",f}async function w(a,b,c){return a.evaluate(async({endpoint:a,name:b,expireInDays:c,userEnterpriseId:d})=>{let e=await fetch(a,{method:"POST",mode:"cors",credentials:"include",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify({name:b,expire_in_days:c,user_enterprise_id:d})}),f=await e.text(),g=null;try{g=f?JSON.parse(f):null}catch{g=null}return{ok:e.ok,status:e.status,payload:g,text:g?null:f.slice(0,300)}},{endpoint:"https://www.codebuddy.ai/console/api/client/v1/api-keys",name:b,expireInDays:365,userEnterpriseId:c})}async function x(a,b,c,{existingApiKey:d=null,directReplay:e=!1,userEnterpriseId:f=null}={}){let g,h;if(d)return{skipped:!0,key:d};if(!a){let a=Error("CodeBuddy browser session is not available for API key creation");throw a.step="key_session_invalid",a.status="needs_manual",a}let i=f||j;e?c?.("creating_codebuddy_api_key_direct","Replaying CodeBuddy API key creation from current web session"):(c?.("opening_codebuddy_keys","Opening CodeBuddy Access Keys page"),await a.goto("https://www.codebuddy.ai/profile/keys",{waitUntil:"domcontentloaded",timeout:3e4}),await a.waitForTimeout(2e3),i=(await v(a,c)).userEnterpriseId||i);let k=(g=String(b||"codebuddy").replace(/[^a-zA-Z0-9_.@-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)||"codebuddy",h=new Date().toISOString().replace(/[-:.TZ]/g,"").slice(0,14),`9router-${g}-${h}`.slice(0,50)),l=[k,`${k.slice(0,41)}-${Math.random().toString(36).slice(2,8)}`.slice(0,50)],m=null;for(let b=0;b<l.length;b+=1){let d=l[b];c?.("creating_codebuddy_api_key",`Creating CodeBuddy API key${b?" with retry name":""}`);let e=await w(a,d,i);if(e?.ok&&(e.payload?.code===0||e.payload?.code===200||e.payload?.code===void 0)){let a=function(a,b){let c=a?.data||a||{},d=c.key||c.api_key||c.apiKey;if(!d)return null;let e=c.item||c.apiKeyItem||c;return{key:d,id:e?.key_id||e?.id||e?.keyId||null,name:e?.name||c.name||b,expiresAt:c.expires_at||c.expiresAt||e?.expires_at||e?.expiresAt||null,createdAt:e?.created_at||e?.createdAt||null}}(e.payload,d);if(a?.key)return a;let b=Error("CodeBuddy API key created but secret was not returned");throw b.step="key_create_no_secret",b.status="failed",b}let f=function(a,b){let c=b?.code??b?.error?.code??b?.data?.code,d=b?.msg||b?.message||b?.error?.message||b?.error||`HTTP ${a}`;return 401===a||403===a?{step:"key_session_invalid",status:"needs_manual",message:`CodeBuddy key session invalid (${a})`,retryable:!1}:12601===c?{step:"key_limit_reached",status:"failed",message:"CodeBuddy API key limit reached",retryable:!1}:12502===c?{step:"key_name_exists",status:"failed",message:"CodeBuddy API key name already exists",retryable:!0}:{step:"key_create_failed",status:"failed",message:d||"CodeBuddy API key creation failed",retryable:!1}}(e?.status,e?.payload||{message:e?.text});if(m=f,f.retryable&&0===b)continue;let g=Error(f.message);throw g.step=f.step,g.status=f.status,g}let n=Error(m?.message||"CodeBuddy API key creation failed");throw n.step=m?.step||"key_create_failed",n.status=m?.status||"failed",n}async function y(a,b){let c=(a,c)=>b?.(a,c);try{c("navigating_to_dashboard","Navigating to CodeBuddy to complete registration"),await a.goto("https://www.codebuddy.ai/home",{waitUntil:"domcontentloaded",timeout:3e4}),await a.waitForTimeout(3e3);let b=Date.now(),d=!1;for(;Date.now()-b<3e4&&(0,f.Jl)(a);){if(await (0,f.i_)(a,c)||await (0,f.np)(a,c)||await (0,f.$K)(a,c,h)){d=!0,await a.waitForTimeout(1500);continue}break}d&&c("complete_register_done","CodeBuddy registration completed, establishing session"),c("codebuddy_registration_ready","CodeBuddy registration flow is ready for API key creation")}catch(a){c("complete_register_skipped",`Could not complete registration: ${a.message}`)}}async function z({manager:a,job:b,account:c,context:d,page:e,tokens:f,email:g,createOptions:h={}}){let i=f||{};if(e){let d=await t(e,(d,e)=>{a.setAccountStep(c,d,e),a.persistJobSnapshot(b,{forcePreview:!1})});i={...i,providerSpecificData:{...i.providerSpecificData||{},codebuddyRegionSubmitOk:d.ok,codebuddyRegionSubmitCode:d.code??null,codebuddyRegionSubmitMessage:d.message||null}};let f=await u(e,(d,e)=>{a.setAccountStep(c,d,e),a.persistJobSnapshot(b,{forcePreview:!1})});if(!f.ok){let a=Error(f.message||"CodeBuddy IDE trial activation failed");throw a.step="trial_not_activated",a.status="trial_not_activated",a}i={...i,providerSpecificData:{...i.providerSpecificData||{},codebuddyTrialState:f.state||null,codebuddyTrialCode:f.code??null,codebuddyTrialMessage:f.message||null}}}a.setAccountStep(c,"creating_codebuddy_api_key","Generating CodeBuddy Access Key"),await a.persistJobSnapshot(b,{forcePreview:!0});let j=i.apiKey||i.generatedApiKey?.key||await a.findExistingApiKey(g),k=j?{skipped:!0,key:j}:await a.createApiKey(e,g,(d,e)=>{a.setAccountStep(c,d,e),a.persistJobSnapshot(b,{forcePreview:!1})},{existingApiKey:j,...h});a.setAccountStep(c,"saving_connection","Saving CodeBuddy connection with generated API key"),await a.persistJobSnapshot(b,{forcePreview:!0});let l=await r(d,{...i,...k?.skipped?{}:{generatedApiKey:k}}),{connection:m}=await a.saveConnection({tokens:l,email:g});return a.finalizeAccount(c,"success",{connectionId:m.id,step:"connection_saved",message:k?.skipped?"CodeBuddy connection already has an API key":"CodeBuddy connection saved with generated API key"}),{connection:m,generatedApiKey:k}}async function A(a,b=500){if(!a)return{};try{let c=await Promise.race([a,k(b).then(()=>null)]);return c?.tokens||{}}catch{return{}}}async function B({manager:a,job:b,account:c,context:d,page:e,successPromise:f,reason:g}){a.setAccountStep(c,"restricted_key_replay","Restricted page detected; replaying CodeBuddy Access Key creation from web session"),await a.persistJobSnapshot(b,{forcePreview:!0});let h=await A(f);return z({manager:a,job:b,account:c,context:d,page:e,tokens:{...h,providerSpecificData:{...h.providerSpecificData||{},restrictedDetected:!0,restrictedReason:g||"Account restricted page detected during automation",oauthTokenCaptured:!!h.accessToken}},email:c.email,createOptions:{directReplay:!0,userEnterpriseId:j}})}class C extends d.Q6{constructor({browserLauncher:a,googleAutomation:b=e.rk,requestDeviceCodeFn:c=m,pollToken:d=n,saveConnection:f=l,createApiKeyFn:g=x,findExistingApiKeyFn:h=p,fetchLoginAccountFn:i=o,pollIntervalMs:j=5e3}={}){super({browserLauncher:a,googleAutomation:b,storageName:"codebuddy-bulk-import"}),this.requestDeviceCode=c,this.pollToken=d,this.saveConnection=f,this.createApiKey=g,this.findExistingApiKey=h,this.fetchLoginAccount=i,this.pollIntervalMs=j}async runManualFollowup(a,b,c,d,e){let f=(async()=>{let c=async()=>{let a=b.manualSession,c=a?.context||d,e=a?.headedBrowser||null;c&&await c.close().catch(()=>null),e&&await e.close().catch(()=>null)};try{let c=await e;if(a.cancelRequested){this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}),await this.persistJobSnapshot(a,{forcePreview:!0});return}let f=b.manualSession?.page;f&&(this.setAccountStep(b,"completing_registration","Completing CodeBuddy registration"),await this.persistJobSnapshot(a,{forcePreview:!0}),await y(f,(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})})),await z({manager:this,job:a,account:b,context:b.manualSession?.context||d,page:f||b.manualSession?.page,tokens:c.tokens,email:b.email}),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(c){a.cancelRequested?this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}):this.finalizeAccount(b,c.status||"failed_exchange",{error:c.message||"Manual assist flow failed during token polling.",step:c.step||"exchange_failed",message:c.message||"Manual assist flow failed during token polling."}),await this.persistJobSnapshot(a,{forcePreview:!0})}finally{await c(),b.manualSession=null,b.runtimeSession=null,a.manualFollowups.delete(f),await this.persistJobSnapshot(a,{forcePreview:!0})}})();a.manualFollowups.add(f)}async processAccount(a,b,c){if(a.cancelRequested||!a.browser)return void this.finalizeAccount(b,"cancelled",{error:"Job cancelled"});let{context:e,page:f}=await (0,d.go)(a.browser,b.proxyUrl);b.runtimeSession={context:e,page:f};try{this.setAccountStep(b,"preparing_worker",`Worker ${c} is preparing a browser context`),await this.persistJobSnapshot(a,{forcePreview:!0}),this.setAccountStep(b,"requesting_codebuddy_state","Requesting CodeBuddy OAuth state");let d=await this.requestDeviceCode(g),i=function(a,b){if(!a&&!b)return a;let c=new URL(a||"https://www.codebuddy.ai/login"),d=c.searchParams.get("platform")||"CLI",e=b||c.searchParams.get("state"),f=new URL("https://www.codebuddy.ai/login");return f.searchParams.set("platform",d),e&&f.searchParams.set("state",e),f.toString()}(d.verification_uri,d.device_code);if(!i||!d.device_code)throw Error("CodeBuddy did not return an OAuth login URL");let j=function({deviceCode:a,pollToken:b,onStep:c,fetchLoginAccount:d=o,timeoutMs:e=9e5,pollIntervalMs:f=5e3,maxTransientErrors:h=6}){return(async()=>{let i=Date.now(),j=0,l=0;for(;Date.now()-i<e;){Date.now()-j>f-100&&(c?.("polling_codebuddy_token","Waiting for CodeBuddy OAuth token"),j=Date.now());let e=await b(g,a);if(e.success){let b=e.tokens?.accessToken||e.tokens?.access_token,c=await d(b,a);return{tokens:{...e.tokens,providerSpecificData:{...e.tokens?.providerSpecificData||{},...c?.uid?{uid:c.uid}:{},...c?.nickname?{nickname:c.nickname}:{},...c?.enterpriseId?{enterpriseId:c.enterpriseId}:{},...c?.enterpriseName?{enterpriseName:c.enterpriseName}:{},...c?.rawAuth?{rawAuth:c.rawAuth}:{},domain:"www.codebuddy.ai",oauthState:a}}}}if(!e.pending&&"authorization_pending"!==e.error&&"slow_down"!==e.error){if("request_failed"===e.error&&l<h){l+=1,c?.("codebuddy_poll_retry",`CodeBuddy token poll failed temporarily (${l}/${h}); retrying`),await k(f);continue}throw Error(e.errorDescription||e.error||"CodeBuddy OAuth polling failed")}await k(f)}throw Error("Timed out waiting for CodeBuddy OAuth token")})()}({deviceCode:d.device_code,pollToken:this.pollToken,fetchLoginAccount:this.fetchLoginAccount,pollIntervalMs:this.pollIntervalMs,onStep:(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})}});j.catch(()=>null);let l=await this.googleAutomation({page:f,authUrl:i,email:b.email,password:b.password,successPromise:j,serviceLabel:h,openingStep:"opening_codebuddy_oauth",openingMessage:"Opening CodeBuddy OAuth page",successStep:"codebuddy_token_received",successMessage:"CodeBuddy OAuth token received",onStep:(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})}});if("success"===l.status){this.setAccountStep(b,"completing_registration","Completing CodeBuddy registration"),await this.persistJobSnapshot(a,{forcePreview:!0}),await y(f,(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})});let{connection:c}=await z({manager:this,job:a,account:b,context:e,page:f,tokens:l.tokens,email:b.email});b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0});return}if("failed_restricted"===l.status){await B({manager:this,job:a,account:b,context:e,page:f,successPromise:j,reason:l.error}),b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0});return}if("needs_manual"===l.status){b.manualSession={context:e,page:f,opened:!1,openedAt:null},this.setAccountStep(b,"awaiting_manual","Waiting for manual completion in the browser session"),this.finalizeAccount(b,"needs_manual",{error:l.error,step:"awaiting_manual",message:l.error}),await this.persistJobSnapshot(a,{forcePreview:!0}),await this.runManualFollowup(a,b,c,e,j);return}this.finalizeAccount(b,l.status||"failed",{error:l.error||"CodeBuddy Google automation failed.",step:l.status||"failed",message:l.error||"CodeBuddy Google automation failed."}),b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(c){a.cancelRequested?this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while CodeBuddy automation was running"}):this.finalizeAccount(b,c.status||"failed",{error:c.message||"Unexpected CodeBuddy bulk import failure.",step:c.step||"failed",message:c.message||"Unexpected CodeBuddy bulk import failure."}),b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0})}finally{b.password=void 0}}}function D(){return(!globalThis.__codeBuddyBulkImportSingleton&&(globalThis.__codeBuddyBulkImportSingleton={manager:new C}),globalThis.__codeBuddyBulkImportSingleton).manager}},92130:(a,b,c)=>{c.d(b,{rk:()=>d.rk});var d=c(82506)}};
1
+ "use strict";exports.id=891,exports.ids=[891],exports.modules={40891:(a,b,c)=>{c.d(b,{cO:()=>d.cO,Ol:()=>D,L_:()=>d.$w});var d=c(33342),e=c(92130),f=c(82506);let g="codebuddy",h="CodeBuddy",i=new Set(["codebuddy.ai","www.codebuddy.ai"]),j="personal-edition-user-id";function k(a){return new Promise(b=>setTimeout(b,a))}async function l({tokens:a,email:b}){let{createProviderConnection:d}=await Promise.resolve().then(c.bind(c,71998)),e={...a.providerSpecificData||{},loginEmail:b,automation:"gsuite-bulk"};a.webCookie&&(e.webCookie=a.webCookie,e.webCookieCapturedAt=a.webCookieCapturedAt||new Date().toISOString()),a.generatedApiKey&&(e.codebuddyApiKeyId=a.generatedApiKey.id||null,e.codebuddyApiKeyName=a.generatedApiKey.name||null,e.codebuddyApiKeyExpiresAt=a.generatedApiKey.expiresAt||null,e.authMode="generated-api-key");let f={provider:g,authType:"oauth",...a,email:b,providerSpecificData:e,expiresAt:a.expiresIn?new Date(Date.now()+1e3*a.expiresIn).toISOString():null,testStatus:"active"},h=a.generatedApiKey?.key||a.apiKey;return h&&(f.apiKey=h),{connection:await d(f)}}async function m(a){let{requestDeviceCode:b}=await Promise.all([c.e(5433),c.e(5024),c.e(4404),c.e(8590),c.e(3110),c.e(318),c.e(8895),c.e(4177),c.e(3159)]).then(c.bind(c,74177));return b(a)}async function n(a,b){let{pollForToken:d}=await Promise.all([c.e(5433),c.e(5024),c.e(4404),c.e(8590),c.e(3110),c.e(318),c.e(8895),c.e(4177),c.e(3159)]).then(c.bind(c,74177));return d(a,b)}async function o(a,b,c="www.codebuddy.ai"){if(!a||!b)return null;try{let d=await fetch(`https://${c}/v2/plugin/login/account?state=${encodeURIComponent(b)}`,{method:"GET",headers:{Authorization:`Bearer ${a}`,Accept:"application/json","X-Domain":c}});if(!d.ok)return null;let e=await d.json(),f=e?.data||e||{};if(!f||"object"!=typeof f)return null;return{uid:f.uid||null,nickname:f.nickname||null,email:f.email||null,enterpriseId:f.enterpriseId||null,enterpriseName:f.enterpriseName||null,rawAuth:f}}catch{return null}}async function p(a){if(!a)return null;try{let{getProviderConnections:b}=await Promise.resolve().then(c.bind(c,71998)),d=(await b({provider:g})).find(b=>"oauth"===b.authType&&b.email===a&&b.apiKey);return d?.apiKey||null}catch{return null}}async function q(a){if(!a?.cookies)return console.warn("[CodeBuddy] captureWebCookie: context.cookies not available"),null;try{let b=await a.cookies(["https://www.codebuddy.ai","https://codebuddy.ai"]);console.log(`[CodeBuddy] captureWebCookie: found ${b.length} raw cookies from browser context`);let c=b.filter(a=>{let b=String(a.domain||"").replace(/^\./,"").toLowerCase();return i.has(b)||b.endsWith(".codebuddy.ai")}).filter(a=>a.name&&a.value).sort((a,b)=>String(a.name).localeCompare(String(b.name)));if(0===c.length)return console.warn("[CodeBuddy] captureWebCookie: no useful cookies after filtering. Raw cookie names:",b.map(a=>`${a.name}@${a.domain}`).join(", ")),null;let d=c.map(a=>`${a.name}=${a.value}`).join("; ");return console.log(`[CodeBuddy] captureWebCookie: captured ${c.length} cookies (${d.length} chars). Names: ${c.map(a=>a.name).join(", ")}`),d}catch(a){return console.error("[CodeBuddy] captureWebCookie error:",a.message),null}}async function r(a,b={}){let c=await q(a);return c?{...b,webCookie:c,webCookieCapturedAt:new Date().toISOString()}:b}async function s(a,b,{method:c="POST",headers:d={},referrer:e,body:f}={}){return a.evaluate(async({url:a,method:b,headers:c,referrer:d,body:e})=>{let f=await fetch(a,{method:b,credentials:"include",headers:c,referrer:d,body:null==e?null:JSON.stringify(e)}),g=await f.text().catch(()=>""),h=null;try{h=g?JSON.parse(g):null}catch{h={raw:g}}return{ok:f.ok,status:f.status,payload:h,text:g}},{url:b,method:c,headers:d,referrer:e,body:f})}async function t(a,b){b?.("submitting_codebuddy_region_profile","Submitting CodeBuddy region profile via account API");let c=await s(a,"https://www.codebuddy.ai/console/login/account",{method:"POST",headers:{accept:"application/json, text/plain, */*","content-type":"application/json","x-requested-with":"XMLHttpRequest","x-domain":"www.codebuddy.ai"},referrer:"https://www.codebuddy.ai/register/user/complete",body:{attributes:{countryCode:["62"],countryFullName:["Indonesia"],countryName:["ID"]}}});return c.ok&&(c.payload?.code===0||c.payload?.code===200||void 0===c.payload?.code)?{ok:!0,code:c.payload?.code??0,message:c.payload?.msg||c.payload?.message||"OK"}:{ok:!1,code:c.payload?.code??c.status,message:c.payload?.msg||c.payload?.message||c.text||`HTTP ${c.status}`}}async function u(a,b){b?.("activating_codebuddy_trial","Applying or verifying CodeBuddy IDE trial");let c=()=>s(a,"https://www.codebuddy.ai/billing/ide/trial",{method:"POST",headers:{accept:"application/json, text/plain, */*","x-requested-with":"XMLHttpRequest","x-domain":"www.codebuddy.ai"},referrer:"https://www.codebuddy.ai/profile/plan",body:null}),d=await c(),e=d?.payload?.code;if(d.ok&&14051===e)return{ok:!0,code:e,state:"already_applied",message:d.payload?.msg||"has applied trial"};if(d.ok&&(0===e||200===e||void 0===e)){await k(1200);let a=await c(),b=a?.payload?.code;return a.ok&&(0===b||200===b||14051===b||void 0===b)?{ok:!0,code:b??e??0,state:14051===b?"applied_confirmed":"applied",message:a.payload?.msg||d.payload?.msg||"OK"}:{ok:!1,code:b??a.status,message:a.payload?.msg||a.payload?.message||a.text||`HTTP ${a.status}`}}return{ok:!1,code:e??d.status,message:d.payload?.msg||d.payload?.message||d.text||`HTTP ${d.status}`}}async function v(a,b,c=45e3){let d=Date.now(),e=null;for(;Date.now()-d<c;){let c=await a.evaluate(async()=>{try{let a=await fetch("/console/accounts",{method:"GET",credentials:"include",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json","x-requested-with":"XMLHttpRequest","X-Domain":window.location.hostname||"www.codebuddy.ai"}}),b=await a.text(),c=null;try{c=b?JSON.parse(b):null}catch{c=null}let d=c?.data?.accounts||c?.accounts||[];return{ok:a.ok,status:a.status,payload:c,accounts:d}}catch(a){return{ok:!1,status:0,error:a?.message||String(a)}}});if(c?.ok&&Array.isArray(c.accounts)&&c.accounts.length>0){let a=c.accounts.find(a=>a?.lastLogin)||c.accounts[0]||{};return{account:a,userEnterpriseId:a.type&&"personal"!==a.type&&a.enterpriseId?a.enterpriseId:j}}e=c?.error||`status=${c?.status||"unknown"}`,b?.("waiting_codebuddy_key_session",`Waiting for CodeBuddy web console session (${e})`),await a.waitForTimeout(1500)}let f=Error(`CodeBuddy key session invalid: ${e||"no account session"}`);throw f.step="key_session_invalid",f.status="needs_manual",f}async function w(a,b,c){return a.evaluate(async({endpoint:a,name:b,expireInDays:c,userEnterpriseId:d})=>{let e=await fetch(a,{method:"POST",mode:"cors",credentials:"include",headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json"},body:JSON.stringify({name:b,expire_in_days:c,user_enterprise_id:d})}),f=await e.text(),g=null;try{g=f?JSON.parse(f):null}catch{g=null}return{ok:e.ok,status:e.status,payload:g,text:g?null:f.slice(0,300)}},{endpoint:"https://www.codebuddy.ai/console/api/client/v1/api-keys",name:b,expireInDays:365,userEnterpriseId:c})}async function x(a,b,c,{existingApiKey:d=null,directReplay:e=!1,userEnterpriseId:f=null}={}){let g,h;if(d)return{skipped:!0,key:d};if(!a){let a=Error("CodeBuddy browser session is not available for API key creation");throw a.step="key_session_invalid",a.status="needs_manual",a}let i=f||j;e?c?.("creating_codebuddy_api_key_direct","Replaying CodeBuddy API key creation from current web session"):(c?.("opening_codebuddy_keys","Opening CodeBuddy Access Keys page"),await a.goto("https://www.codebuddy.ai/profile/keys",{waitUntil:"domcontentloaded",timeout:3e4}),await a.waitForTimeout(2e3),i=(await v(a,c)).userEnterpriseId||i);let k=(g=String(b||"codebuddy").replace(/[^a-zA-Z0-9_.@-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)||"codebuddy",h=new Date().toISOString().replace(/[-:.TZ]/g,"").slice(0,14),`9router-${g}-${h}`.slice(0,50)),l=[k,`${k.slice(0,41)}-${Math.random().toString(36).slice(2,8)}`.slice(0,50)],m=null;for(let b=0;b<l.length;b+=1){let d=l[b];c?.("creating_codebuddy_api_key",`Creating CodeBuddy API key${b?" with retry name":""}`);let e=await w(a,d,i);if(e?.ok&&(e.payload?.code===0||e.payload?.code===200||e.payload?.code===void 0)){let a=function(a,b){let c=a?.data||a||{},d=c.key||c.api_key||c.apiKey;if(!d)return null;let e=c.item||c.apiKeyItem||c;return{key:d,id:e?.key_id||e?.id||e?.keyId||null,name:e?.name||c.name||b,expiresAt:c.expires_at||c.expiresAt||e?.expires_at||e?.expiresAt||null,createdAt:e?.created_at||e?.createdAt||null}}(e.payload,d);if(a?.key)return a;let b=Error("CodeBuddy API key created but secret was not returned");throw b.step="key_create_no_secret",b.status="failed",b}let f=function(a,b){let c=b?.code??b?.error?.code??b?.data?.code,d=b?.msg||b?.message||b?.error?.message||b?.error||`HTTP ${a}`;return 401===a||403===a?{step:"key_session_invalid",status:"needs_manual",message:`CodeBuddy key session invalid (${a})`,retryable:!1}:12601===c?{step:"key_limit_reached",status:"failed",message:"CodeBuddy API key limit reached",retryable:!1}:12502===c?{step:"key_name_exists",status:"failed",message:"CodeBuddy API key name already exists",retryable:!0}:{step:"key_create_failed",status:"failed",message:d||"CodeBuddy API key creation failed",retryable:!1}}(e?.status,e?.payload||{message:e?.text});if(m=f,f.retryable&&0===b)continue;let g=Error(f.message);throw g.step=f.step,g.status=f.status,g}let n=Error(m?.message||"CodeBuddy API key creation failed");throw n.step=m?.step||"key_create_failed",n.status=m?.status||"failed",n}async function y(a,b){let c=(a,c)=>b?.(a,c);try{c("navigating_to_dashboard","Navigating to CodeBuddy to complete registration"),await a.goto("https://www.codebuddy.ai/home",{waitUntil:"domcontentloaded",timeout:3e4}),await a.waitForTimeout(3e3);let b=Date.now(),d=!1;for(;Date.now()-b<3e4&&(0,f.Jl)(a);){if(await (0,f.i_)(a,c)||await (0,f.np)(a,c)||await (0,f.$K)(a,c,h)){d=!0,await a.waitForTimeout(1500);continue}break}d&&c("complete_register_done","CodeBuddy registration completed, establishing session"),c("codebuddy_registration_ready","CodeBuddy registration flow is ready for API key creation")}catch(a){c("complete_register_skipped",`Could not complete registration: ${a.message}`)}}async function z({manager:a,job:b,account:c,context:d,page:e,tokens:f,email:g,createOptions:h={}}){let i=f||{};if(e){let d=await t(e,(d,e)=>{a.setAccountStep(c,d,e),a.persistJobSnapshot(b,{forcePreview:!1})});i={...i,providerSpecificData:{...i.providerSpecificData||{},codebuddyRegionSubmitOk:d.ok,codebuddyRegionSubmitCode:d.code??null,codebuddyRegionSubmitMessage:d.message||null}};let f=await u(e,(d,e)=>{a.setAccountStep(c,d,e),a.persistJobSnapshot(b,{forcePreview:!1})});if(!f.ok){let a=Error(f.message||"CodeBuddy IDE trial activation failed");throw a.step="trial_not_activated",a.status="trial_not_activated",a}i={...i,providerSpecificData:{...i.providerSpecificData||{},codebuddyTrialState:f.state||null,codebuddyTrialCode:f.code??null,codebuddyTrialMessage:f.message||null}}}a.setAccountStep(c,"creating_codebuddy_api_key","Generating CodeBuddy Access Key"),await a.persistJobSnapshot(b,{forcePreview:!0});let j=i.apiKey||i.generatedApiKey?.key||await a.findExistingApiKey(g),k=j?{skipped:!0,key:j}:await a.createApiKey(e,g,(d,e)=>{a.setAccountStep(c,d,e),a.persistJobSnapshot(b,{forcePreview:!1})},{existingApiKey:j,...h});a.setAccountStep(c,"saving_connection","Saving CodeBuddy connection with generated API key"),await a.persistJobSnapshot(b,{forcePreview:!0});let l=await r(d,{...i,...k?.skipped?{}:{generatedApiKey:k}}),{connection:m}=await a.saveConnection({tokens:l,email:g});return a.finalizeAccount(c,"success",{connectionId:m.id,step:"connection_saved",message:k?.skipped?"CodeBuddy connection already has an API key":"CodeBuddy connection saved with generated API key"}),{connection:m,generatedApiKey:k}}async function A(a,b=500){if(!a)return{};try{let c=await Promise.race([a,k(b).then(()=>null)]);return c?.tokens||{}}catch{return{}}}async function B({manager:a,job:b,account:c,context:d,page:e,successPromise:f,reason:g}){a.setAccountStep(c,"restricted_key_replay","Restricted page detected; replaying CodeBuddy Access Key creation from web session"),await a.persistJobSnapshot(b,{forcePreview:!0});let h=await A(f);return z({manager:a,job:b,account:c,context:d,page:e,tokens:{...h,providerSpecificData:{...h.providerSpecificData||{},restrictedDetected:!0,restrictedReason:g||"Account restricted page detected during automation",oauthTokenCaptured:!!h.accessToken}},email:c.email,createOptions:{directReplay:!0,userEnterpriseId:j}})}class C extends d.Q6{constructor({browserLauncher:a,googleAutomation:b=e.rk,requestDeviceCodeFn:c=m,pollToken:d=n,saveConnection:f=l,createApiKeyFn:g=x,findExistingApiKeyFn:h=p,fetchLoginAccountFn:i=o,pollIntervalMs:j=5e3}={}){super({browserLauncher:a,googleAutomation:b,storageName:"codebuddy-bulk-import"}),this.requestDeviceCode=c,this.pollToken=d,this.saveConnection=f,this.createApiKey=g,this.findExistingApiKey=h,this.fetchLoginAccount=i,this.pollIntervalMs=j}async runManualFollowup(a,b,c,d,e){let f=(async()=>{let c=async()=>{let a=b.manualSession,c=a?.context||d,e=a?.headedBrowser||null;c&&await c.close().catch(()=>null),e&&await e.close().catch(()=>null)};try{let c=await e;if(a.cancelRequested){this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}),await this.persistJobSnapshot(a,{forcePreview:!0});return}let f=b.manualSession?.page;f&&(this.setAccountStep(b,"completing_registration","Completing CodeBuddy registration"),await this.persistJobSnapshot(a,{forcePreview:!0}),await y(f,(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})})),await z({manager:this,job:a,account:b,context:b.manualSession?.context||d,page:f||b.manualSession?.page,tokens:c.tokens,email:b.email}),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(c){a.cancelRequested?this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while waiting for manual completion"}):this.finalizeAccount(b,c.status||"failed_exchange",{error:c.message||"Manual assist flow failed during token polling.",step:c.step||"exchange_failed",message:c.message||"Manual assist flow failed during token polling."}),await this.persistJobSnapshot(a,{forcePreview:!0})}finally{await c(),b.manualSession=null,b.runtimeSession=null,a.manualFollowups.delete(f),await this.persistJobSnapshot(a,{forcePreview:!0})}})();a.manualFollowups.add(f)}async processAccount(a,b,c){if(a.cancelRequested||!a.browser)return void this.finalizeAccount(b,"cancelled",{error:"Job cancelled"});let{context:e,page:f}=await (0,d.go)(a.browser,b.proxyUrl);b.runtimeSession={context:e,page:f};try{this.setAccountStep(b,"preparing_worker",`Worker ${c} is preparing a browser context`),await this.persistJobSnapshot(a,{forcePreview:!0}),this.setAccountStep(b,"requesting_codebuddy_state","Requesting CodeBuddy OAuth state");let d=await this.requestDeviceCode(g),i=function(a,b){if(!a&&!b)return a;let c=new URL(a||"https://www.codebuddy.ai/login"),d=c.searchParams.get("platform")||"CLI",e=b||c.searchParams.get("state"),f=new URL("https://www.codebuddy.ai/login");return f.searchParams.set("platform",d),e&&f.searchParams.set("state",e),f.toString()}(d.verification_uri,d.device_code);if(!i||!d.device_code)throw Error("CodeBuddy did not return an OAuth login URL");let j=function({deviceCode:a,pollToken:b,onStep:c,fetchLoginAccount:d=o,timeoutMs:e=9e5,pollIntervalMs:f=5e3,maxTransientErrors:h=6}){return(async()=>{let i=Date.now(),j=0,l=0;for(;Date.now()-i<e;){Date.now()-j>f-100&&(c?.("polling_codebuddy_token","Waiting for CodeBuddy OAuth token"),j=Date.now());let e=await b(g,a);if(e.success){let b=e.tokens?.accessToken||e.tokens?.access_token,c=await d(b,a);return{tokens:{...e.tokens,providerSpecificData:{...e.tokens?.providerSpecificData||{},...c?.uid?{uid:c.uid}:{},...c?.nickname?{nickname:c.nickname}:{},...c?.enterpriseId?{enterpriseId:c.enterpriseId}:{},...c?.enterpriseName?{enterpriseName:c.enterpriseName}:{},...c?.rawAuth?{rawAuth:c.rawAuth}:{},domain:"www.codebuddy.ai",oauthState:a}}}}if(!e.pending&&"authorization_pending"!==e.error&&"slow_down"!==e.error){if("request_failed"===e.error&&l<h){l+=1,c?.("codebuddy_poll_retry",`CodeBuddy token poll failed temporarily (${l}/${h}); retrying`),await k(f);continue}throw Error(e.errorDescription||e.error||"CodeBuddy OAuth polling failed")}await k(f)}throw Error("Timed out waiting for CodeBuddy OAuth token")})()}({deviceCode:d.device_code,pollToken:this.pollToken,fetchLoginAccount:this.fetchLoginAccount,pollIntervalMs:this.pollIntervalMs,onStep:(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})}});j.catch(()=>null);let l=await this.googleAutomation({page:f,authUrl:i,email:b.email,password:b.password,successPromise:j,serviceLabel:h,openingStep:"opening_codebuddy_oauth",openingMessage:"Opening CodeBuddy OAuth page",successStep:"codebuddy_token_received",successMessage:"CodeBuddy OAuth token received",onStep:(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})}});if("success"===l.status){this.setAccountStep(b,"completing_registration","Completing CodeBuddy registration"),await this.persistJobSnapshot(a,{forcePreview:!0}),await y(f,(c,d)=>{this.setAccountStep(b,c,d),this.persistJobSnapshot(a,{forcePreview:!1})});let{connection:c}=await z({manager:this,job:a,account:b,context:e,page:f,tokens:l.tokens,email:b.email});b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0});return}if("failed_restricted"===l.status){await B({manager:this,job:a,account:b,context:e,page:f,successPromise:j,reason:l.error}),b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0});return}if("needs_manual"===l.status){b.manualSession={context:e,page:f,opened:!1,openedAt:null},this.setAccountStep(b,"awaiting_manual","Waiting for manual completion in the browser session"),this.finalizeAccount(b,"needs_manual",{error:l.error,step:"awaiting_manual",message:l.error}),await this.persistJobSnapshot(a,{forcePreview:!0}),await this.runManualFollowup(a,b,c,e,j);return}this.finalizeAccount(b,l.status||"failed",{error:l.error||"CodeBuddy Google automation failed.",step:l.status||"failed",message:l.error||"CodeBuddy Google automation failed."}),b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0})}catch(c){a.cancelRequested?this.finalizeAccount(b,"cancelled",{error:"Job cancelled",step:"cancelled",message:"Job cancelled while CodeBuddy automation was running"}):this.finalizeAccount(b,c.status||"failed",{error:c.message||"Unexpected CodeBuddy bulk import failure.",step:c.step||"failed",message:c.message||"Unexpected CodeBuddy bulk import failure."}),b.runtimeSession=null,await e.close().catch(()=>null),await this.persistJobSnapshot(a,{forcePreview:!0})}finally{b.password=void 0}}}function D(){return(!globalThis.__codeBuddyBulkImportSingleton&&(globalThis.__codeBuddyBulkImportSingleton={manager:new C}),globalThis.__codeBuddyBulkImportSingleton).manager}},92130:(a,b,c)=>{c.d(b,{rk:()=>d.rk});var d=c(82506)}};