vansrouter 0.9.72 → 0.9.75

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 (662) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +9 -9
  3. package/app/.next-cli-build/build-manifest.json +3 -3
  4. package/app/.next-cli-build/prerender-manifest.json +3 -3
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +2 -2
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  74. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  76. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  77. package/app/.next-cli-build/server/app/_global-error.rsc +2 -2
  78. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +2 -2
  79. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  83. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +2 -2
  84. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  85. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  86. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  87. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  88. package/app/.next-cli-build/server/app/_not-found.rsc +19 -19
  89. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +19 -19
  90. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  91. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +8 -8
  92. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  93. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  94. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +3 -2
  95. package/app/.next-cli-build/server/app/api/auth/check/route.js +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/check/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  102. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
  104. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
  106. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  107. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js +1 -1
  108. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  109. package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
  110. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  112. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  115. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  118. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  120. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  125. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
  128. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  130. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  131. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +2 -2
  132. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  133. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  136. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
  138. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  140. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  142. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  144. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  146. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  148. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
  150. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  152. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js +1 -1
  153. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  154. package/app/.next-cli-build/server/app/api/headroom/restart/route.js +1 -1
  155. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/headroom/start/route.js +1 -1
  157. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/headroom/status/route.js +1 -1
  159. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  164. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
  166. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
  171. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  173. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
  177. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  179. package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
  180. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
  182. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  188. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  194. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  199. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
  203. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  205. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  208. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js +1 -1
  210. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  213. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
  215. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
  217. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  219. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
  221. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/providers/[id]/gcp-projects/route.js +1 -1
  223. package/app/.next-cli-build/server/app/api/providers/[id]/gcp-projects/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  225. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  227. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  229. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  231. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  232. package/app/.next-cli-build/server/app/api/providers/circuit-breakers/[name]/reset/route.js +1 -1
  233. package/app/.next-cli-build/server/app/api/providers/circuit-breakers/[name]/reset/route.js.nft.json +1 -1
  234. package/app/.next-cli-build/server/app/api/providers/circuit-breakers/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  236. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  239. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  242. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  244. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
  246. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  248. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +1 -1
  250. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +1 -1
  252. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
  254. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
  256. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +1 -1
  262. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  264. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +1 -1
  265. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
  268. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  270. package/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
  271. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  273. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  277. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +3 -5
  279. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  283. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  284. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  285. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  286. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  287. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  288. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  289. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  290. package/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
  291. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  292. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
  293. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  294. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  295. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  297. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +3 -3
  299. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  300. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  301. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  303. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
  309. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  311. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/usage/request-details/[id]/route.js +1 -1
  313. package/app/.next-cli-build/server/app/api/usage/request-details/[id]/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
  315. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
  317. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  318. package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
  319. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/usage/stream/route.js +1 -1
  321. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  323. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  324. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  325. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  327. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  329. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  330. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  332. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +2 -2
  334. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  335. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  336. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  337. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  338. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  339. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  340. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  341. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  342. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  343. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  344. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  345. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  346. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  347. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  348. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  349. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  350. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  351. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  352. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  353. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  354. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  355. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  356. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  357. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  358. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  359. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  360. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  361. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  362. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  363. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  364. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  365. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  366. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  367. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  368. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  369. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  370. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  371. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  372. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  373. package/app/.next-cli-build/server/app/callback.html +1 -1
  374. package/app/.next-cli-build/server/app/callback.rsc +23 -23
  375. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +23 -23
  376. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  377. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +8 -8
  378. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +3 -2
  379. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  380. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  381. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  382. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +22 -22
  383. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  384. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  385. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  386. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  387. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +22 -22
  388. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  389. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +8 -8
  390. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +3 -2
  391. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  392. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +23 -23
  393. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  394. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  395. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  396. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  397. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +23 -23
  398. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  399. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +8 -8
  400. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +3 -2
  401. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  402. package/app/.next-cli-build/server/app/dashboard/combos.rsc +25 -25
  403. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  404. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  405. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  406. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  407. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +25 -25
  408. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  409. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +8 -8
  410. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +3 -2
  411. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  412. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +23 -23
  413. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  414. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  415. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  416. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  417. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +23 -23
  418. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  419. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +8 -8
  420. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +3 -2
  421. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  422. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +26 -24
  423. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  424. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  425. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  426. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  427. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  428. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +26 -24
  429. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  430. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +8 -8
  431. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +3 -2
  432. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  433. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +22 -22
  434. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  435. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  436. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  437. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  438. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +22 -22
  439. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  440. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +8 -8
  441. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +3 -2
  442. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  443. package/app/.next-cli-build/server/app/dashboard/profile.rsc +25 -25
  444. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  445. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  446. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  447. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  448. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +25 -25
  449. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  450. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +8 -8
  451. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +3 -2
  452. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  453. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +26 -24
  454. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  455. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  456. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  457. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  458. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  459. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +26 -24
  460. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  461. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +8 -8
  462. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +3 -2
  463. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  464. package/app/.next-cli-build/server/app/dashboard/providers.rsc +25 -25
  465. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  466. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  467. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  468. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  469. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +25 -25
  470. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  471. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +8 -8
  472. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +3 -2
  473. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  474. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +25 -25
  475. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  476. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  477. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  478. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  479. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +25 -25
  480. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  481. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +8 -8
  482. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +3 -2
  483. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  484. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +22 -22
  485. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  486. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
  487. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  488. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  489. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +22 -22
  490. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
  491. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +8 -8
  492. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +3 -2
  493. package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  494. package/app/.next-cli-build/server/app/dashboard/quota.rsc +23 -23
  495. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  496. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  497. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  498. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  499. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +23 -23
  500. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  501. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +8 -8
  502. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +3 -2
  503. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  504. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  505. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  506. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  507. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +23 -23
  508. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +23 -23
  509. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  510. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +8 -8
  511. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +3 -2
  512. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  513. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  514. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  515. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  516. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  517. package/app/.next-cli-build/server/app/dashboard/skills.rsc +25 -25
  518. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  519. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  520. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  521. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  522. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +25 -25
  523. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  524. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +8 -8
  525. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +3 -2
  526. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  527. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +22 -22
  528. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  529. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  530. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  531. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  532. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +22 -22
  533. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  534. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +8 -8
  535. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +3 -2
  536. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  537. package/app/.next-cli-build/server/app/dashboard/translator.rsc +25 -25
  538. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  539. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  540. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  541. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  542. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +25 -25
  543. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  544. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +8 -8
  545. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +3 -2
  546. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  547. package/app/.next-cli-build/server/app/dashboard/usage.rsc +25 -25
  548. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  549. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  550. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  551. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  552. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +25 -25
  553. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  554. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +8 -8
  555. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +3 -2
  556. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  557. package/app/.next-cli-build/server/app/dashboard.rsc +23 -23
  558. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  559. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  560. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  561. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +23 -23
  562. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  563. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +8 -8
  564. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +3 -2
  565. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  566. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  567. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  568. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  569. package/app/.next-cli-build/server/app/landing.html +1 -1
  570. package/app/.next-cli-build/server/app/landing.rsc +23 -23
  571. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +23 -23
  572. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  573. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +8 -8
  574. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +3 -2
  575. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  576. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  577. package/app/.next-cli-build/server/app/login/page.js +1 -1
  578. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  579. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  580. package/app/.next-cli-build/server/app/login.html +1 -1
  581. package/app/.next-cli-build/server/app/login.rsc +23 -23
  582. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +23 -23
  583. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  584. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +8 -8
  585. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +3 -2
  586. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  587. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  588. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  589. package/app/.next-cli-build/server/app/masuk/page.js +1 -1
  590. package/app/.next-cli-build/server/app/masuk/page.js.nft.json +1 -1
  591. package/app/.next-cli-build/server/app/masuk/page_client-reference-manifest.js +1 -1
  592. package/app/.next-cli-build/server/app-paths-manifest.json +9 -9
  593. package/app/.next-cli-build/server/chunks/1632.js +1 -0
  594. package/app/.next-cli-build/server/chunks/1688.js +2 -2
  595. package/app/.next-cli-build/server/chunks/2262.js +2 -2
  596. package/app/.next-cli-build/server/chunks/2557.js +7 -7
  597. package/app/.next-cli-build/server/chunks/3040.js +2 -2
  598. package/app/.next-cli-build/server/chunks/3405.js +2 -2
  599. package/app/.next-cli-build/server/chunks/3539.js +1 -0
  600. package/app/.next-cli-build/server/chunks/3559.js +1 -0
  601. package/app/.next-cli-build/server/chunks/3736.js +1 -1
  602. package/app/.next-cli-build/server/chunks/383.js +1 -1
  603. package/app/.next-cli-build/server/chunks/4105.js +1 -1
  604. package/app/.next-cli-build/server/chunks/4121.js +1 -1
  605. package/app/.next-cli-build/server/chunks/4539.js +2 -2
  606. package/app/.next-cli-build/server/chunks/4836.js +1 -1
  607. package/app/.next-cli-build/server/chunks/5006.js +1 -1
  608. package/app/.next-cli-build/server/chunks/5050.js +1 -0
  609. package/app/.next-cli-build/server/chunks/{9633.js → 5267.js} +12 -4
  610. package/app/.next-cli-build/server/chunks/5302.js +1 -1
  611. package/app/.next-cli-build/server/chunks/5414.js +1 -0
  612. package/app/.next-cli-build/server/chunks/5577.js +1 -1
  613. package/app/.next-cli-build/server/chunks/5638.js +2 -2
  614. package/app/.next-cli-build/server/chunks/6165.js +2 -2
  615. package/app/.next-cli-build/server/chunks/622.js +1 -0
  616. package/app/.next-cli-build/server/chunks/6385.js +1 -1
  617. package/app/.next-cli-build/server/chunks/{8385.js → 6723.js} +1 -1
  618. package/app/.next-cli-build/server/chunks/7006.js +2 -2
  619. package/app/.next-cli-build/server/chunks/740.js +1 -1
  620. package/app/.next-cli-build/server/chunks/7938.js +2 -2
  621. package/app/.next-cli-build/server/chunks/7950.js +1 -0
  622. package/app/.next-cli-build/server/chunks/8057.js +2 -2
  623. package/app/.next-cli-build/server/chunks/856.js +1 -0
  624. package/app/.next-cli-build/server/chunks/8691.js +2 -2
  625. package/app/.next-cli-build/server/chunks/8765.js +1 -1
  626. package/app/.next-cli-build/server/chunks/9984.js +1 -1
  627. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  628. package/app/.next-cli-build/server/middleware.js +3 -3
  629. package/app/.next-cli-build/server/pages/404.html +1 -1
  630. package/app/.next-cli-build/server/pages/500.html +1 -1
  631. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  632. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  633. package/app/.next-cli-build/static/chunks/2940-e9e17b73a8dbb236.js +1 -0
  634. package/app/.next-cli-build/static/chunks/{4385-4845cea1b0d2634c.js → 4385-edcd1dd4526ccb0c.js} +1 -1
  635. package/app/.next-cli-build/static/chunks/9131-de9f8f7aa6d37223.js +3 -0
  636. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-5de110c9d826db7a.js +1 -0
  637. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-91427dc2416753e5.js +1 -0
  638. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-31a282df958d7d97.js +1 -0
  639. package/app/.next-cli-build/static/chunks/app/landing/page-7a5a45d8af9fc7a7.js +1 -0
  640. package/app/.next-cli-build/static/chunks/app/layout-4fd9787928e78424.js +1 -0
  641. package/app/.next-cli-build/static/chunks/{webpack-bc04f378a1088de3.js → webpack-ace861933f9767e3.js} +1 -1
  642. package/app/.next-cli-build/static/css/176108f7913ea72b.css +1 -0
  643. package/app/package.json +2 -2
  644. package/app/src/shared/services/quotaAutoPing.js +1 -1
  645. package/package.json +1 -1
  646. package/app/.next-cli-build/server/chunks/1929.js +0 -1
  647. package/app/.next-cli-build/server/chunks/2732.js +0 -1
  648. package/app/.next-cli-build/server/chunks/3950.js +0 -1
  649. package/app/.next-cli-build/server/chunks/5300.js +0 -1
  650. package/app/.next-cli-build/server/chunks/8171.js +0 -1
  651. package/app/.next-cli-build/server/chunks/9162.js +0 -1
  652. package/app/.next-cli-build/server/chunks/935.js +0 -1
  653. package/app/.next-cli-build/static/chunks/2940-48989ef09fe01727.js +0 -1
  654. package/app/.next-cli-build/static/chunks/9131-35d90b99e28db378.js +0 -3
  655. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/page-79d84c4805fde654.js +0 -1
  656. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/page-64441a0e58f1ec16.js +0 -1
  657. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-307e6341d1f0b15e.js +0 -1
  658. package/app/.next-cli-build/static/chunks/app/landing/page-775bf0f40a06728d.js +0 -1
  659. package/app/.next-cli-build/static/chunks/app/layout-c7e89b3e4871eeaa.js +0 -1
  660. package/app/.next-cli-build/static/css/04cdd30b78c3f748.css +0 -1
  661. /package/app/.next-cli-build/static/{Uwqu2CTKkonNUYF-jGylG → pnhvfkLAO8ddG3CSpJ-Gs}/_buildManifest.js +0 -0
  662. /package/app/.next-cli-build/static/{Uwqu2CTKkonNUYF-jGylG → pnhvfkLAO8ddG3CSpJ-Gs}/_ssgManifest.js +0 -0
@@ -14,14 +14,14 @@ ${b}`:b;return}if(Array.isArray(a.system)){if(a.system.some(a=>a.text===b))retur
14
14
 
15
15
  ${c.content}`:b)}},14018:(a,b,c)=>{c.d(b,{DT:()=>q,NE:()=>r});var d=c(69152),e=c(56974),f=c(39621),g=c(77380),h=c(73329),i=c(15261),j=c(92398),k=c(98757),l=c(50996),m=c(92913),n=c(23648),o=c(97781),p=c(15204);function q(a,b){if(!a?.choices?.[0])return a;let c=a.choices[0],d=c.message||{},e=d.content||"",f=d.reasoning_content||"",g=d.tool_calls||[],h=[];for(let a of(f&&h.push({type:"thinking",thinking:f}),e&&h.push({type:"text",text:e}),g)){let b={};try{b=JSON.parse(a.function?.arguments||"{}")}catch{}h.push({type:"tool_use",id:a.id,name:a.function?.name||"",input:b})}let i=c.finish_reason;"stop"===i?i="end_turn":"tool_calls"===i&&(i="tool_use");let j=a.usage||{},k={};return null!=j.prompt_tokens&&(k.input_tokens=j.prompt_tokens,k.output_tokens=j.completion_tokens||0,j.prompt_tokens_details?.cached_tokens&&(k.cache_read_input_tokens=j.prompt_tokens_details.cached_tokens),j.completion_tokens_details?.reasoning_tokens&&(k.output_tokens=(j.completion_tokens||0)+j.completion_tokens_details.reasoning_tokens)),{id:`msg_${(a.id||"").replace("chatcmpl-","")||Date.now()}`,type:"message",role:"assistant",content:h,model:b||a.model||"claude",stop_reason:i,stop_sequence:null,usage:k}}async function r({providerResponse:a,provider:b,model:c,sourceFormat:s,targetFormat:t,body:u,stream:v,translatedBody:w,finalBody:x,requestStartTime:y,connectionId:z,apiKey:A,apiKeyName:B,clientRawRequest:C,onRequestSuccess:D,reqLogger:E,toolNameMap:F,trackDone:G,appendLog:H,pxpipe:I,comboName:J}){let K;if(G(),(a.headers.get("content-type")||"").includes("text/event-stream")){let b=await a.text(),d=(0,l.F)(b,c,(0,p.Qv)(u?.tools));if(!d)return H({status:`FAILED ${j.gx.BAD_GATEWAY}`}),(0,i.A1)(j.gx.BAD_GATEWAY,"Invalid SSE response for non-streaming request");K=d}else try{K=await a.json()}catch(a){return H({status:`FAILED ${j.gx.BAD_GATEWAY}`}),console.error(`[ChatCore] Failed to parse JSON from ${b}:`,a.message),(0,i.A1)(j.gx.BAD_GATEWAY,`Invalid JSON response from ${b}`)}E.logProviderResponse(a.status,a.statusText,a.headers,K),D&&Promise.resolve().then(D).catch(a=>{console.error("[ChatCore] onRequestSuccess failed:",a?.message||a)});{let{body:a,error:c}=(0,k.K)(K,b);if(c)return H({status:`FAILED ${j.gx.BAD_GATEWAY}`}),(0,i.A1)(j.gx.BAD_GATEWAY,c.message);K=a}K=(0,o.kR)(K,F);let L=(0,m.MK)(K);H({tokens:L,status:"200 OK"}),(0,m.qr)({provider:b,model:c,tokens:L,connectionId:z,apiKey:A,endpoint:C?.endpoint,comboName:J});let M=(0,e.nZ)(t,s)?function(a,b,c){if(b===c||b===d.h.OPENAI)return a;if(b===d.h.GEMINI||b===d.h.ANTIGRAVITY||b===d.h.GEMINI_CLI||b===d.h.VERTEX){let b=a.response||a;if(!b?.candidates?.[0])return a;let c=b.candidates[0],d=c.content,e=b.usageMetadata||a.usageMetadata,f="",g="",h=[];if(d?.parts)for(let a of d.parts){!0===a.thought&&a.text?g+=a.text:void 0!==a.text&&(f+=a.text),a.functionCall&&h.push({id:`call_${a.functionCall.name}_${Date.now()}_${h.length}`,type:"function",function:{name:a.functionCall.name,arguments:JSON.stringify(a.functionCall.args||{})}});let b=a.inlineData||a.inline_data;if(b?.data){let a=b.mimeType||b.mime_type||"image/png";f+=`
16
16
  ![image](data:${a};base64,${b.data})
17
- `}}let i={role:"assistant"};f&&(i.content=f),g&&(i.reasoning_content=g),h.length>0&&(i.tool_calls=h),i.content||i.tool_calls||(i.content="");let j=(c.finishReason||"stop").toLowerCase();"stop"===j&&h.length>0&&(j="tool_calls");let k={id:`chatcmpl-${b.responseId||Date.now()}`,object:"chat.completion",created:Math.floor(new Date(b.createTime||Date.now()).getTime()/1e3),model:b.modelVersion||"gemini",choices:[{index:0,message:i,finish_reason:j}]};return e&&(k.usage={prompt_tokens:(e.promptTokenCount||0)+(e.thoughtsTokenCount||0),completion_tokens:e.candidatesTokenCount||0,total_tokens:e.totalTokenCount||0},e.thoughtsTokenCount>0&&(k.usage.completion_tokens_details={reasoning_tokens:e.thoughtsTokenCount})),k}if(b===d.h.CLAUDE){if(a.choices||a.content&&!Array.isArray(a.content))return a;let b="",c="",d=[];for(let e of a.content||[])"text"===e.type?b+=(e.text??"").replace(/^\s*```\s*json\s*\n?/i,"").replace(/\n?\s*```\s*$/i,""):"thinking"===e.type?c+=e.thinking||"":"tool_use"===e.type&&d.push({id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.input||{})}});let e={role:"assistant"};b&&(e.content=b),c&&(e.reasoning_content=c),d.length>0&&(e.tool_calls=d),e.content||e.tool_calls||(e.content="");let f=a.stop_reason||"stop";"end_turn"===f&&(f="stop"),"tool_use"===f&&(f="tool_calls");let g={id:`chatcmpl-${a.id||Date.now()}`,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:a.model||"claude",choices:[{index:0,message:e,finish_reason:f}]};return a.usage&&(g.usage={prompt_tokens:a.usage.prompt_tokens||a.usage.input_tokens||0,completion_tokens:a.usage.completion_tokens||a.usage.output_tokens||0,total_tokens:a.usage.total_tokens||(a.usage.prompt_tokens||a.usage.input_tokens||0)+(a.usage.completion_tokens||a.usage.output_tokens||0)},a.usage.completion_tokens_details&&(g.usage.completion_tokens_details=a.usage.completion_tokens_details)),g}return b===d.h.OLLAMA?(0,f._)(a):a}(K,t,s):K,N=!1,O=M;if(s===d.h.CLAUDE&&t!==d.h.CLAUDE){let a=q(M,c);O=(0,o.kR)(a,F),N=!0}if(!N){if(/kimi-k2\./i.test(c||"")&&Array.isArray(M?.choices))for(let a of M.choices){let b=a?.message;if(!b||"assistant"!==b.role)continue;let{message:c,hasTools:d}=(0,g.vH)(b);d&&(a.message=c)}if(M?.choices?.[0]){let a=M.choices[0],b=a.message;Array.isArray(b?.tool_calls)&&b.tool_calls.length>0&&"tool_calls"!==a.finish_reason&&(a.finish_reason="tool_calls")}if(M.object||(M.object="chat.completion"),M.created||(M.created=Math.floor(Date.now()/1e3)),delete M.prompt_filter_results,M?.choices)for(let a of M.choices)delete a.content_filter_results;if(M?.usage&&(M.usage=(0,h.WL)((0,h.O9)(M.usage),s)),M?.choices)for(let a of M.choices){let b=a?.message;b&&(b.reasoning_content&&b.content&&delete b.reasoning_content,b.provider_specific_fields?.reasoning_content&&b.content&&delete b.provider_specific_fields.reasoning_content,b.provider_specific_fields?.reasoning&&b.content&&delete b.provider_specific_fields.reasoning)}}E.logConvertedResponse(O);let P=Date.now()-y,Q=O?.choices?.[0]?.message?.content||(Array.isArray(O?.content)?O.content.find(a=>"text"===a.type)?.text||"":null)||"",R=O?.choices?.[0]?.message?.reasoning_content||(Array.isArray(O?.content)?O.content.find(a=>"thinking"===a.type)?.thinking:null)||null,S=O?.choices?.[0]?.finish_reason||O?.stop_reason||"unknown";return(0,n.ox)((0,m.$R)({provider:b,model:c,connectionId:z,apiKey:A,apiKeyName:B,latency:{ttft:P,total:P},tokens:L||{prompt_tokens:0,completion_tokens:0},request:(0,m.Fo)(u,v),providerRequest:x||w||null,providerResponse:K||null,response:{content:Q,thinking:R,finish_reason:S},pxpipe:I,status:"success"},{endpoint:C?.endpoint||null})).catch(a=>{console.error("[RequestDetail] Failed to save:",a.message)}),{success:!0,response:new Response(JSON.stringify(O),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}},23648:(a,b,c)=>{c.d(b,{BY:()=>d.BY,E5:()=>d.E5,Rw:()=>d.Rw,SL:()=>d.SL,Zx:()=>d.Zx,_V:()=>d._V,j$:()=>d.j$,ox:()=>d.ox,rg:()=>d.rg,sZ:()=>d.sZ,uw:()=>d.uw});var d=c(45479)},34496:(a,b,c)=>{function d(a){return String(a||"").toLowerCase().replace(/\s+/g," ").replace(/[.!?â€Ļ]+$/g,"").trim()}function e(a){let b=a?.messages;if(!Array.isArray(b)||0===b.length)return{detected:!1,hint:null};let c=function(a){let b=[];for(let c of a)if(c?.role==="assistant"&&Array.isArray(c.tool_calls))for(let a of c.tool_calls)b.push(function(a){let b=a?.function?.name||a?.name||"",c=function(a){try{let b=JSON.parse(a);return JSON.stringify(b,Object.keys(b).sort())}catch{return a||""}}(a?.function?.arguments||a?.arguments||"");return`${b}::${c}`}(a));return b}(b);if(c.length>=3){if(function(a){let b=new Map;for(let c of a)if(b.set(c,(b.get(c)||0)+1),b.get(c)>=3)return c;return null}(c))return{detected:!0,hint:"You have called the same tool with identical arguments multiple times with no new progress. STOP repeating. Summarize findings from existing results or change your strategy."};if(function(a){let b=a.length;for(let c=Math.floor(b/2);c>=2;c--)for(let d=0;d<=b-2*c;d++){let e=a.slice(d,d+c).join("|"),f=0,g=0;for(;g<=b-c;)a.slice(g,g+c).join("|")===e?(f++,g+=c):g++;if(f>=2)return e}return null}(c))return{detected:!0,hint:"You have repeated the same sequence of tool calls multiple times. This is a loop. STOP this pattern immediately. Summarize what you have already found or take a completely different approach."}}let e=function(a){let b=function(a){let b=[];for(let c of a)if(c?.role==="assistant"){let a=c?"string"==typeof c.content?c.content:Array.isArray(c.content)?c.content.filter(a=>a&&"string"==typeof a.text).map(a=>a.text).join(" "):"":"";a.length>=12&&b.push(a)}return b}(a);if(b.length<3)return{detected:!1,hint:null};let c=new Map;for(let a of b){let b=d(a);if(b.length<12)continue;let e=(c.get(b)||0)+1;if(c.set(b,e),e>=3)return{detected:!0,hint:"You have repeated the same response multiple times without making progress. This is a text loop — you are NOT moving forward. STOP repeating yourself. Either call a tool to act, or give your final answer now with the information you already have."}}let e=new Map;for(let a of b)for(let b of String(a||"").split(/[\n.!?â€Ļ]+/).map(a=>d(a)).filter(a=>a.length>=12)){let a=(e.get(b)||0)+1;if(e.set(b,a),a>=3)return{detected:!0,hint:"You keep repeating the same planning statement without acting on it. STOP planning in circles. Either execute a tool call NOW, or provide your final answer with current knowledge. Do not restate your plan again."}}return{detected:!1,hint:null}}(b);return e.detected?e:{detected:!1,hint:null}}c.d(b,{k:()=>e})},36110:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{wk:()=>N});var e=c(217),f=c(54729),g=c(56974),h=c(69152),i=c(42966),j=c(67860),k=c(78963),l=c(91392),m=c(86954),n=c(52554),o=c(85577),p=c(13946),q=c(15261),r=c(92398),s=c(83571),t=c(23648),u=c(63548),v=c(44027),w=c(92913),x=c(50996),y=c(14018),z=c(60137),A=c(92201),B=c(94054),C=c(61210),D=c(34496),E=c(63192),F=c(56764),G=c(8789),H=c(72152),I=c(69188),J=c(7916),K=c(81297),L=c(80117),M=a([u]);u=(M.then?(await M)():M)[0];let O=new Set(["kimchi","nvidia"]);async function N({body:a,modelInfo:b,credentials:c,log:d,onCredentialsRefreshed:M,onRequestSuccess:P,onDisconnect:Q,clientRawRequest:R,connectionId:S,userAgent:T,apiKey:U,apiKeyName:V=null,ccFilterNaming:W,rtkEnabled:X,headroomEnabled:Y,headroomUrl:Z,headroomCompressUserMessages:$,cavemanEnabled:_,cavemanLevel:aa,ponytailEnabled:ab,ponytailLevel:ac,pxpipeEnabled:ad=!1,pxpipeMinChars:ae=1e3,pxpipeTimeoutMs:af=1e4,pxpipeTransform:ag="png",onPxpipeEvent:ah=null,sourceFormatOverride:ai,providerThinking:aj,clientSignal:ak,loopGuardEnabled:al=!0}){var am;let an,ao,ap,aq,ar,as,{provider:at,model:au,accountCount:av=0}=b,aw=Date.now(),ax=ai||(0,f.Tz)(a),ay=(0,s.c)(a,au,T,W);if(ay)return ay;let az=o.Xg[at]||at,aA=(0,o.ux)(az,au),aB=(0,f.oF)(at,ax),aC=aA||aB?.format||(0,f.jJ)(at);aB&&c&&(c.runtimeTransport=aB);let aD=(0,o.cY)(az,au),aE=(0,o.kt)(az,au);if(aj?.mode&&"auto"!==aj.mode){let b=(0,J.nl)(at,au);if(b?.reasoning){let c=aj.mode;"on"!==c||a.thinking?"off"!==c||a.thinking?a.reasoning_effort||(a={...a,reasoning_effort:c}):!1!==b.thinkingCanDisable&&(a={...a,thinking:{type:"disabled"}}):a={...a,thinking:{type:"enabled",budget_tokens:1e4}}}}let aF=!0===a.stream||ax===h.h.ANTIGRAVITY||ax===h.h.GEMINI||ax===h.h.GEMINI_CLI,aG=p.xq[at]?.forceStream===!0,aH=!!aG||!1!==a.stream,aI="nvidia"===at&&/kimi-k2\.[67]/i.test(au||"")&&!0===aH,aJ=!aI&&aH;aI&&d?.debug?.("STREAMCOERCE",`${at}/${au} | stream=true → false (upstream)`);let aK=(0,o.OA)(az,au);("imageGen"===aK||/image|imagen|image-generation/i.test(au))&&("antigravity"===at||"gemini-cli"===at)&&(aH=!1);let aL=(0,B.J)(R?.headers||{},a);"deepseek-tui"===aL&&!0!==a.stream&&(aH=!1);let aM=R?.headers?.accept||"",aN=aM.includes("application/json"),aO=aM.includes("text/event-stream");!aN||aO||!0===a.stream||aG||(aH=!1);let aP=await (0,m.q)(ax,aC,au);R&&aP.logClientRawRequest(R.endpoint,R.body,R.headers),aP.logRawRequest(a),d?.debug?.("FORMAT",`${ax} → ${aC} | stream=${aH}`);let aQ=(0,B.J)(R?.headers||{},a),aR=(0,B.Q)(aQ,at);if(c&&(c.rawHeaders=R?.headers||{}),!aR){let b=(0,J.nl)(at,au);(0,K.X)(a,ax,b)&&d?.debug?.("MODALITY",`stripped unsupported media for ${at}/${au}`);try{let b=await (0,L.C)(a,ax,aC,{signal:void 0});b>0&&d?.debug?.("MODALITY",`prefetched ${b} remote image(s) for ${aC}`)}catch(a){d?.warn?.("MODALITY",`image prefetch failed: ${a.message}`)}}if(aR)d?.debug?.("PASSTHROUGH",`${aQ} → ${at} | native lossless`),an={...a,model:aE},"claude"===aQ&&(0,i.u)(an,aE);else{if(!(an=(0,g.GH)(ax,aC,aE,a,aJ,c,at,aP,aD,S,aQ)))return(0,t.uw)(au,at,S,!1,!0),(0,q.A1)(r.gx.BAD_REQUEST,`Failed to translate request for ${ax} → ${aC}`);ao=an._toolNameMap,delete an._toolNameMap,an.model=aE}if(aI&&(an.stream=!1),"claude"===aQ&&Array.isArray(an.tools)){let{tools:a,stripped:b}=(0,C.F)(an.tools);b.length>0&&(an.tools=a,d?.debug?.("TOOLDEDUP",`stripped ${b.length}: ${b.slice(0,3).join(", ")}${b.length>3?"...":""}`))}let aS=aR?ax:aC;if(d?.line){let b=`${at}/${au}`.slice(0,20),e=R?.body?.model||`${at}/${au}`,f=an.messages?.length||an.input?.length||an.contents?.length||a.messages?.length||a.input?.length||0,g=an.tools?.length||a.tools?.length||0,h=aR?`FMT: ${ax} (passthrough)`:`FMT: ${ax}→${aC}`,i="grok-cli"!==at||(0,v.Au)(au)?d.fmtThink?.((0,n.sS)(an)):null,j=c?.connectionName||c?.connectionId?.slice(0,8)||"-",k=[`POST ${e} → ${at}/${au}`,h,aH?"STREAM":"JSON",`${f} MSG`];g&&k.push(`${g} TOOL`),i&&k.push(`THINK:${i}`),k.push(`ACC:${j}`),d.line(b,"â–ļ",k.join(" \xb7 "))}"tts"===(0,o.OA)(az,au)&&an.messages&&(an.messages=an.messages.filter(a=>"tool"!==a.role),delete an.tools);let aT=R?.headers?.[r.SA]?.toLowerCase()!=="off",aU=(0,H.BI)(an,aT&&X),aV=(0,H.fT)(aU);aV&&console.log(aV);let aW={},aX=await (0,I.SI)(an,{enabled:aT&&Y,url:Z,model:aE,format:aS,compressUserMessages:$,diagnostics:aW}),aY=(0,I.Nv)(aX),aZ=(0,I.O2)(aW);if(aY?(d?.info?.("HEADROOM",`${aY}${aZ?` | ${aZ}`:""}`),(0,I.cB)(aX,aW)&&d?.warn?.("HEADROOM",`reported token delta, but outbound JSON shrank <5%; provider may bill near-original payload | ${aZ}`)):aT&&Y&&d?.warn?.("HEADROOM",`skipped: ${aW.reason||"compression unavailable"}${aW.endpoint?` (${aW.endpoint})`:""}`),aT&&_&&aa&&((0,E.p)(an,aS,aa),d?.debug?.("CAVEMAN",`${aa} | ${aS}`)),aT&&ab&&ac&&((0,F.U)(an,aS,ac),d?.debug?.("PONYTAIL",`${ac} | ${aS}`)),O.has(at)&&((0,G.o5)(an,aS,(am=an.tools,Array.isArray(am)?am.map(a=>a?.function?.name||a?.name).filter(a=>"string"==typeof a&&a.trim()):[])),d?.debug?.("TOOLPROTO",`${at}/${au} | ${aS}`)),al&&function(a,b,c,d,e){let f=(0,D.k)(a);if(!f.detected)return;(0,G.sH)(a,b);let g=a?.messages;if(Array.isArray(g)){let a=null;for(let b=g.length-1;b>=0;b--){let c=g[b];if(c&&("user"===c.role||"tool"===c.role)||c&&"assistant"===c.role&&b===g.length-1){a=c;break}}if(a){let b=`
17
+ `}}let i={role:"assistant"};f&&(i.content=f),g&&(i.reasoning_content=g),h.length>0&&(i.tool_calls=h),i.content||i.tool_calls||(i.content="");let j=(c.finishReason||"stop").toLowerCase();"stop"===j&&h.length>0&&(j="tool_calls");let k={id:`chatcmpl-${b.responseId||Date.now()}`,object:"chat.completion",created:Math.floor(new Date(b.createTime||Date.now()).getTime()/1e3),model:b.modelVersion||"gemini",choices:[{index:0,message:i,finish_reason:j}]};return e&&(k.usage={prompt_tokens:(e.promptTokenCount||0)+(e.thoughtsTokenCount||0),completion_tokens:e.candidatesTokenCount||0,total_tokens:e.totalTokenCount||0},e.thoughtsTokenCount>0&&(k.usage.completion_tokens_details={reasoning_tokens:e.thoughtsTokenCount})),k}if(b===d.h.CLAUDE){if(a.choices||a.content&&!Array.isArray(a.content))return a;let b="",c="",d=[];for(let e of a.content||[])"text"===e.type?b+=(e.text??"").replace(/^\s*```\s*json\s*\n?/i,"").replace(/\n?\s*```\s*$/i,""):"thinking"===e.type?c+=e.thinking||"":"tool_use"===e.type&&d.push({id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.input||{})}});let e={role:"assistant"};b&&(e.content=b),c&&(e.reasoning_content=c),d.length>0&&(e.tool_calls=d),e.content||e.tool_calls||(e.content="");let f=a.stop_reason||"stop";"end_turn"===f&&(f="stop"),"tool_use"===f&&(f="tool_calls");let g={id:`chatcmpl-${a.id||Date.now()}`,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:a.model||"claude",choices:[{index:0,message:e,finish_reason:f}]};return a.usage&&(g.usage={prompt_tokens:a.usage.prompt_tokens||a.usage.input_tokens||0,completion_tokens:a.usage.completion_tokens||a.usage.output_tokens||0,total_tokens:a.usage.total_tokens||(a.usage.prompt_tokens||a.usage.input_tokens||0)+(a.usage.completion_tokens||a.usage.output_tokens||0)},a.usage.completion_tokens_details&&(g.usage.completion_tokens_details=a.usage.completion_tokens_details)),g}return b===d.h.OLLAMA?(0,f._)(a):a}(K,t,s):K,N=!1,O=M;if(s===d.h.CLAUDE&&t!==d.h.CLAUDE){let a=q(M,c);O=(0,o.kR)(a,F),N=!0}if(!N){if(/kimi-k2\./i.test(c||"")&&Array.isArray(M?.choices))for(let a of M.choices){let b=a?.message;if(!b||"assistant"!==b.role)continue;let{message:c,hasTools:d}=(0,g.vH)(b);d&&(a.message=c)}if(M?.choices?.[0]){let a=M.choices[0],b=a.message;Array.isArray(b?.tool_calls)&&b.tool_calls.length>0&&"tool_calls"!==a.finish_reason&&(a.finish_reason="tool_calls")}if(M.object||(M.object="chat.completion"),M.created||(M.created=Math.floor(Date.now()/1e3)),delete M.prompt_filter_results,M?.choices)for(let a of M.choices)delete a.content_filter_results;if(M?.usage&&(M.usage=(0,h.WL)((0,h.O9)(M.usage),s)),M?.choices)for(let a of M.choices){let b=a?.message;b&&(b.reasoning_content&&b.content&&delete b.reasoning_content,b.provider_specific_fields?.reasoning_content&&b.content&&delete b.provider_specific_fields.reasoning_content,b.provider_specific_fields?.reasoning&&b.content&&delete b.provider_specific_fields.reasoning)}}E.logConvertedResponse(O);let P=Date.now()-y,Q=O?.choices?.[0]?.message?.content||(Array.isArray(O?.content)?O.content.find(a=>"text"===a.type)?.text||"":null)||"",R=O?.choices?.[0]?.message?.reasoning_content||(Array.isArray(O?.content)?O.content.find(a=>"thinking"===a.type)?.thinking:null)||null,S=O?.choices?.[0]?.finish_reason||O?.stop_reason||"unknown";return(0,n.ox)((0,m.$R)({provider:b,model:c,connectionId:z,apiKey:A,apiKeyName:B,latency:{ttft:P,total:P},tokens:L||{prompt_tokens:0,completion_tokens:0},request:(0,m.Fo)(u,v),providerRequest:x||w||null,providerResponse:K||null,response:{content:Q,thinking:R,finish_reason:S},pxpipe:I,status:"success"},{endpoint:C?.endpoint||null})).catch(a=>{console.error("[RequestDetail] Failed to save:",a.message)}),{success:!0,response:new Response(JSON.stringify(O),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}},23648:(a,b,c)=>{c.d(b,{BY:()=>d.BY,E5:()=>d.E5,Rw:()=>d.Rw,SL:()=>d.SL,Zx:()=>d.Zx,_V:()=>d._V,j$:()=>d.j$,ox:()=>d.ox,rg:()=>d.rg,sZ:()=>d.sZ,uw:()=>d.uw});var d=c(77725)},34496:(a,b,c)=>{function d(a){return String(a||"").toLowerCase().replace(/\s+/g," ").replace(/[.!?â€Ļ]+$/g,"").trim()}function e(a){let b=a?.messages;if(!Array.isArray(b)||0===b.length)return{detected:!1,hint:null};let c=function(a){let b=[];for(let c of a)if(c?.role==="assistant"&&Array.isArray(c.tool_calls))for(let a of c.tool_calls)b.push(function(a){let b=a?.function?.name||a?.name||"",c=function(a){try{let b=JSON.parse(a);return JSON.stringify(b,Object.keys(b).sort())}catch{return a||""}}(a?.function?.arguments||a?.arguments||"");return`${b}::${c}`}(a));return b}(b);if(c.length>=3){if(function(a){let b=new Map;for(let c of a)if(b.set(c,(b.get(c)||0)+1),b.get(c)>=3)return c;return null}(c))return{detected:!0,hint:"You have called the same tool with identical arguments multiple times with no new progress. STOP repeating. Summarize findings from existing results or change your strategy."};if(function(a){let b=a.length;for(let c=Math.floor(b/2);c>=2;c--)for(let d=0;d<=b-2*c;d++){let e=a.slice(d,d+c).join("|"),f=0,g=0;for(;g<=b-c;)a.slice(g,g+c).join("|")===e?(f++,g+=c):g++;if(f>=2)return e}return null}(c))return{detected:!0,hint:"You have repeated the same sequence of tool calls multiple times. This is a loop. STOP this pattern immediately. Summarize what you have already found or take a completely different approach."}}let e=function(a){let b=function(a){let b=[];for(let c of a)if(c?.role==="assistant"){let a=c?"string"==typeof c.content?c.content:Array.isArray(c.content)?c.content.filter(a=>a&&"string"==typeof a.text).map(a=>a.text).join(" "):"":"";a.length>=12&&b.push(a)}return b}(a);if(b.length<3)return{detected:!1,hint:null};let c=new Map;for(let a of b){let b=d(a);if(b.length<12)continue;let e=(c.get(b)||0)+1;if(c.set(b,e),e>=3)return{detected:!0,hint:"You have repeated the same response multiple times without making progress. This is a text loop — you are NOT moving forward. STOP repeating yourself. Either call a tool to act, or give your final answer now with the information you already have."}}let e=new Map;for(let a of b)for(let b of String(a||"").split(/[\n.!?â€Ļ]+/).map(a=>d(a)).filter(a=>a.length>=12)){let a=(e.get(b)||0)+1;if(e.set(b,a),a>=3)return{detected:!0,hint:"You keep repeating the same planning statement without acting on it. STOP planning in circles. Either execute a tool call NOW, or provide your final answer with current knowledge. Do not restate your plan again."}}return{detected:!1,hint:null}}(b);return e.detected?e:{detected:!1,hint:null}}c.d(b,{k:()=>e})},36110:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{wk:()=>N});var e=c(217),f=c(54729),g=c(56974),h=c(69152),i=c(42966),j=c(45479),k=c(78963),l=c(91392),m=c(86954),n=c(52554),o=c(85577),p=c(13946),q=c(15261),r=c(92398),s=c(83571),t=c(23648),u=c(63548),v=c(44027),w=c(92913),x=c(50996),y=c(14018),z=c(60137),A=c(92201),B=c(94054),C=c(61210),D=c(34496),E=c(63192),F=c(56764),G=c(8789),H=c(72152),I=c(69188),J=c(7916),K=c(81297),L=c(80117),M=a([u]);u=(M.then?(await M)():M)[0];let O=new Set(["kimchi","nvidia"]);async function N({body:a,modelInfo:b,credentials:c,log:d,onCredentialsRefreshed:M,onRequestSuccess:P,onDisconnect:Q,clientRawRequest:R,connectionId:S,userAgent:T,apiKey:U,apiKeyName:V=null,ccFilterNaming:W,rtkEnabled:X,headroomEnabled:Y,headroomUrl:Z,headroomCompressUserMessages:$,cavemanEnabled:_,cavemanLevel:aa,ponytailEnabled:ab,ponytailLevel:ac,pxpipeEnabled:ad=!1,pxpipeMinChars:ae=1e3,pxpipeTimeoutMs:af=1e4,pxpipeTransform:ag="png",onPxpipeEvent:ah=null,sourceFormatOverride:ai,providerThinking:aj,clientSignal:ak,loopGuardEnabled:al=!0}){var am;let an,ao,ap,aq,ar,as,{provider:at,model:au,accountCount:av=0}=b,aw=Date.now(),ax=ai||(0,f.Tz)(a),ay=(0,s.c)(a,au,T,W);if(ay)return ay;let az=o.Xg[at]||at,aA=(0,o.ux)(az,au),aB=(0,f.oF)(at,ax),aC=aA||aB?.format||(0,f.jJ)(at);aB&&c&&(c.runtimeTransport=aB);let aD=(0,o.cY)(az,au),aE=(0,o.kt)(az,au);if(aj?.mode&&"auto"!==aj.mode){let b=(0,J.nl)(at,au);if(b?.reasoning){let c=aj.mode;"on"!==c||a.thinking?"off"!==c||a.thinking?a.reasoning_effort||(a={...a,reasoning_effort:c}):!1!==b.thinkingCanDisable&&(a={...a,thinking:{type:"disabled"}}):a={...a,thinking:{type:"enabled",budget_tokens:1e4}}}}let aF=!0===a.stream||ax===h.h.ANTIGRAVITY||ax===h.h.GEMINI||ax===h.h.GEMINI_CLI,aG=p.xq[at]?.forceStream===!0,aH=!!aG||!1!==a.stream,aI="nvidia"===at&&/kimi-k2\.[67]/i.test(au||"")&&!0===aH,aJ=!aI&&aH;aI&&d?.debug?.("STREAMCOERCE",`${at}/${au} | stream=true → false (upstream)`);let aK=(0,o.OA)(az,au);("imageGen"===aK||/image|imagen|image-generation/i.test(au))&&("antigravity"===at||"gemini-cli"===at)&&(aH=!1);let aL=(0,B.J)(R?.headers||{},a);"deepseek-tui"===aL&&!0!==a.stream&&(aH=!1);let aM=R?.headers?.accept||"",aN=aM.includes("application/json"),aO=aM.includes("text/event-stream");!aN||aO||!0===a.stream||aG||(aH=!1);let aP=await (0,m.q)(ax,aC,au);R&&aP.logClientRawRequest(R.endpoint,R.body,R.headers),aP.logRawRequest(a),d?.debug?.("FORMAT",`${ax} → ${aC} | stream=${aH}`);let aQ=(0,B.J)(R?.headers||{},a),aR=(0,B.Q)(aQ,at);if(c&&(c.rawHeaders=R?.headers||{}),!aR){let b=(0,J.nl)(at,au);(0,K.X)(a,ax,b)&&d?.debug?.("MODALITY",`stripped unsupported media for ${at}/${au}`);try{let b=await (0,L.C)(a,ax,aC,{signal:void 0});b>0&&d?.debug?.("MODALITY",`prefetched ${b} remote image(s) for ${aC}`)}catch(a){d?.warn?.("MODALITY",`image prefetch failed: ${a.message}`)}}if(aR)d?.debug?.("PASSTHROUGH",`${aQ} → ${at} | native lossless`),an={...a,model:aE},"claude"===aQ&&(0,i.u)(an,aE);else{if(!(an=(0,g.GH)(ax,aC,aE,a,aJ,c,at,aP,aD,S,aQ)))return(0,t.uw)(au,at,S,!1,!0),(0,q.A1)(r.gx.BAD_REQUEST,`Failed to translate request for ${ax} → ${aC}`);ao=an._toolNameMap,delete an._toolNameMap,an.model=aE}if(aI&&(an.stream=!1),"claude"===aQ&&Array.isArray(an.tools)){let{tools:a,stripped:b}=(0,C.F)(an.tools);b.length>0&&(an.tools=a,d?.debug?.("TOOLDEDUP",`stripped ${b.length}: ${b.slice(0,3).join(", ")}${b.length>3?"...":""}`))}let aS=aR?ax:aC;if(d?.line){let b=`${at}/${au}`.slice(0,20),e=R?.body?.model||`${at}/${au}`,f=an.messages?.length||an.input?.length||an.contents?.length||a.messages?.length||a.input?.length||0,g=an.tools?.length||a.tools?.length||0,h=aR?`FMT: ${ax} (passthrough)`:`FMT: ${ax}→${aC}`,i="grok-cli"!==at||(0,v.Au)(au)?d.fmtThink?.((0,n.sS)(an)):null,j=c?.connectionName||c?.connectionId?.slice(0,8)||"-",k=[`POST ${e} → ${at}/${au}`,h,aH?"STREAM":"JSON",`${f} MSG`];g&&k.push(`${g} TOOL`),i&&k.push(`THINK:${i}`),k.push(`ACC:${j}`),d.line(b,"â–ļ",k.join(" \xb7 "))}"tts"===(0,o.OA)(az,au)&&an.messages&&(an.messages=an.messages.filter(a=>"tool"!==a.role),delete an.tools);let aT=R?.headers?.[r.SA]?.toLowerCase()!=="off",aU=(0,H.BI)(an,aT&&X),aV=(0,H.fT)(aU);aV&&console.log(aV);let aW={},aX=await (0,I.SI)(an,{enabled:aT&&Y,url:Z,model:aE,format:aS,compressUserMessages:$,diagnostics:aW}),aY=(0,I.Nv)(aX),aZ=(0,I.O2)(aW);if(aY?(d?.info?.("HEADROOM",`${aY}${aZ?` | ${aZ}`:""}`),(0,I.cB)(aX,aW)&&d?.warn?.("HEADROOM",`reported token delta, but outbound JSON shrank <5%; provider may bill near-original payload | ${aZ}`)):aT&&Y&&d?.warn?.("HEADROOM",`skipped: ${aW.reason||"compression unavailable"}${aW.endpoint?` (${aW.endpoint})`:""}`),aT&&_&&aa&&((0,E.p)(an,aS,aa),d?.debug?.("CAVEMAN",`${aa} | ${aS}`)),aT&&ab&&ac&&((0,F.U)(an,aS,ac),d?.debug?.("PONYTAIL",`${ac} | ${aS}`)),O.has(at)&&((0,G.o5)(an,aS,(am=an.tools,Array.isArray(am)?am.map(a=>a?.function?.name||a?.name).filter(a=>"string"==typeof a&&a.trim()):[])),d?.debug?.("TOOLPROTO",`${at}/${au} | ${aS}`)),al&&function(a,b,c,d,e){let f=(0,D.k)(a);if(!f.detected)return;(0,G.sH)(a,b);let g=a?.messages;if(Array.isArray(g)){let a=null;for(let b=g.length-1;b>=0;b--){let c=g[b];if(c&&("user"===c.role||"tool"===c.role)||c&&"assistant"===c.role&&b===g.length-1){a=c;break}}if(a){let b=`
18
18
 
19
- [ROUTER NOTE: ${f.hint}]`;"string"==typeof a.content?a.content.includes("[ROUTER NOTE:")||(a.content+=b):Array.isArray(a.content)?a.content.some(a=>a.text&&a.text.includes("[ROUTER NOTE:"))||a.content.push({type:"text",text:b}):a.content=b.trimStart()}}e?.warn?.("LOOPGUARD",`${c}/${d} | loop detected, hint injected`)}(an,aS,at,au,d),/(?:^|[/_-])kimi(?:[/_-]|$)|(?:^|[/_-])kimi-k2\.(?:6|7)(?:\b|[-_/])/i.test(`${at}/${au}`)&&((0,G.sH)(an,aS),d?.debug?.("TERMINATION",`${at}/${au} | ${aS}`)),aj?.mode&&"auto"!==aj.mode){let a=(0,J.nl)(at,au);if(a?.reasoning){let b=aj.mode;"off"===b?(an.reasoning_effort="none",!1!==a.thinkingCanDisable&&(an.thinking={type:"disabled"}),d?.debug?.("THINKING",`${at}/${au} | disabled`)):"on"===b?(an.thinking={type:"enabled",budget_tokens:1e4},d?.debug?.("THINKING",`${at}/${au} | enabled (10k budget)`)):(an.reasoning_effort=b,d?.debug?.("THINKING",`${at}/${au} | effort=${b}`))}}let a$=null;if(ad){let a=await (0,e.H)(an,{enabled:!0,format:aS,model:aE,minChars:ae,timeoutMs:af,transform:ag});a$=a.summary,a.body&&(an=a.body);let b=(0,e._)(a$);b?d?.info?.("PXPIPE",b):d?.debug?.("PXPIPE",`skipped: ${a$.reason}${a$.detail?` (${a$.detail})`:""}`);try{ah?.({provider:at,model:au,...a$})}catch{}}let a_=(0,u.SB)(at);(0,t.uw)(au,at,S,!0),(0,t.E5)({model:au,provider:at,connectionId:S,status:"PENDING"}).catch(()=>{});let a0=an.messages?.length||an.input?.length||an.contents?.length||an.request?.contents?.length||0;d?.debug?.("REQUEST",`${at.toUpperCase()} | ${au} | ${a0} msgs`);let a1=(0,k.jd)({onDisconnect:a=>{(0,t.uw)(au,at,S,!1),Q&&Q(a)},onError:()=>(0,t.uw)(au,at,S,!1),log:d,provider:at,model:au});ak&&(ak.aborted?a1.abort():ak.addEventListener("abort",()=>a1.abort(),{once:!0}));let a2={connectionProxyEnabled:c?.providerSpecificData?.connectionProxyEnabled===!0,connectionProxyUrl:c?.providerSpecificData?.connectionProxyUrl||"",connectionNoProxy:c?.providerSpecificData?.connectionNoProxy||"",vercelRelayUrl:c?.providerSpecificData?.vercelRelayUrl||""};if(a2.vercelRelayUrl){let a=c?.connectionName||c?.connectionId||"unknown",b=c?.providerSpecificData?.connectionProxyPoolId||"none";d?.info?.("PROXY",`${at.toUpperCase()} | ${au} | conn=${a} | pool=${b} | vercel-relay=${a2.vercelRelayUrl}`)}else if(a2.connectionProxyEnabled&&a2.connectionProxyUrl){let a=a2.connectionProxyUrl;try{let b=new URL(a2.connectionProxyUrl),c=b.hostname||"",d=b.port?`:${b.port}`:"",e=b.protocol||"http:";a=`${e}//${c}${d}`}catch{}let b=c?.providerSpecificData?.connectionProxyPoolId||"none",e=c?.connectionName||c?.connectionId||"unknown";d?.info?.("PROXY",`${at.toUpperCase()} | ${au} | conn=${e} | pool=${b} | url=${a}`)}if(a2.connectionProxyEnabled&&a2.connectionNoProxy){let a=c?.connectionName||c?.connectionId||"unknown";d?.debug?.("PROXY",`${at.toUpperCase()} | ${au} | conn=${a} | no_proxy=${a2.connectionNoProxy}`)}let a3=aC;try{let a=await a_.execute({model:au,body:an,stream:aJ,credentials:c,signal:a1.signal,log:d,proxyOptions:a2,accountCount:av});ap=a.response,aq=a.url,ar=a.headers,as=a.transformedBody,a3=a.responseFormat||aC,aP.logTargetRequest(aq,ar,as)}catch(c){if((0,t.uw)(au,at,S,!1,!0),(0,t.E5)({model:au,provider:at,connectionId:S,status:`FAILED ${"AbortError"===c.name?499:r.gx.BAD_GATEWAY}`}).catch(()=>{}),(0,t.ox)((0,w.$R)({provider:at,model:au,connectionId:S,apiKey:U,apiKeyName:V,latency:{ttft:0,total:Date.now()-aw},tokens:{prompt_tokens:0,completion_tokens:0},request:(0,w.Fo)(a,aJ),providerRequest:an||null,response:{error:c.message||String(c),status:"AbortError"===c.name?499:502,thinking:null},pxpipe:a$,status:"error"})).catch(()=>{}),"AbortError"===c.name)return a1.handleError(c),(0,q.A1)(499,"Request aborted");let b=(0,q.lR)(c,at,au,r.gx.BAD_GATEWAY);return console.log(`${j.lm.red}[ERROR] ${b}${j.lm.reset}`),(0,q.A1)(r.gx.BAD_GATEWAY,b)}if(!a_.noAuth&&(ap.status===r.gx.UNAUTHORIZED||ap.status===r.gx.FORBIDDEN))try{let a=await (0,l.qZ)(()=>a_.refreshCredentials(c,d),3,d);if(a?.accessToken||a?.copilotToken){if(d?.info?.("TOKEN",`${at.toUpperCase()} | refreshed`),Object.assign(c,a),M)try{await M(a)}catch(a){d?.warn?.("TOKEN",`onCredentialsRefreshed failed: ${a.message}`)}try{let a=await a_.execute({model:au,body:an,stream:aJ,credentials:c,signal:a1.signal,log:d,proxyOptions:a2,accountCount:av});a.response.ok&&(ap=a.response,aq=a.url,a3=a.responseFormat||aC)}catch{d?.warn?.("TOKEN",`${at.toUpperCase()} | retry after refresh failed`)}}else d?.warn?.("TOKEN",`${at.toUpperCase()} | refresh failed`)}catch(a){d?.warn?.("TOKEN",`${at.toUpperCase()} | refresh threw: ${a.message}`)}if(!ap.ok){(0,t.uw)(au,at,S,!1,!0);let{statusCode:b,message:c,resetsAtMs:d}=await (0,q.zL)(ap,a_);(0,t.E5)({model:au,provider:at,connectionId:S,status:`FAILED ${b}`}).catch(()=>{}),(0,t.ox)((0,w.$R)({provider:at,model:au,connectionId:S,apiKey:U,apiKeyName:V,latency:{ttft:0,total:Date.now()-aw},tokens:{prompt_tokens:0,completion_tokens:0},request:(0,w.Fo)(a,aJ),providerRequest:as||an||null,response:{error:c,status:b,thinking:null},pxpipe:a$,status:"error"})).catch(()=>{});let e=(0,q.lR)(Error(c),at,au,b);return console.log(`${j.lm.red}[ERROR] ${e}${j.lm.reset}`),aP.logError(Error(c),as||an),(0,q.A1)(b,e,d)}let a4={provider:at,model:au,body:a,stream:aH,translatedBody:an,finalBody:as,requestStartTime:aw,connectionId:S,apiKey:U,apiKeyName:V,clientRawRequest:R,onRequestSuccess:P,pxpipe:a$},a5=a=>(0,t.E5)({model:au,provider:at,connectionId:S,...a}).catch(()=>{}),a6=()=>(0,t.uw)(au,at,S,!1);if(aI&&aF){let a=await (0,y.NE)({...a4,stream:aJ,providerResponse:ap,sourceFormat:ax,targetFormat:aC,reqLogger:aP,toolNameMap:ao,trackDone:a6,appendLog:a5});if(!a.success)return a;let b=await a.response.json(),c=(0,A.y)(b);return a1.handleComplete(),{success:!0,response:c}}if(!aF&&aG){let a=await (0,x.I)({...a4,providerResponse:ap,sourceFormat:ax,toolNameMap:ao,trackDone:a6,appendLog:a5});if(a)return a1.handleComplete(),a}if(!aH){let a=await (0,y.NE)({...a4,providerResponse:ap,sourceFormat:ax,targetFormat:a3||aC,reqLogger:aP,toolNameMap:ao,trackDone:a6,appendLog:a5});if("clinepass"===at&&!a?.success&&/empty/i.test(a?.error||"")){d?.warn?.("RETRY","clinepass returned empty content, retrying once after 2s"),await new Promise(a=>setTimeout(a,2e3));try{let b=await a_.execute({model:au,body:an,stream:!1,credentials:c,signal:a1.signal,log:d,proxyOptions:a2});b?.response?.ok&&(ap=b.response,a=await (0,y.NE)({...a4,providerResponse:ap,sourceFormat:ax,targetFormat:a3||aC,reqLogger:aP,toolNameMap:ao,trackDone:a6,appendLog:a5}))}catch(a){d?.warn?.("RETRY",`clinepass retry failed: ${a.message}`)}}return a1.handleComplete(),a}let{onStreamComplete:a7,streamDetailId:a8}=(0,z.$)({...a4});return(0,z.M)({...a4,providerResponse:ap,sourceFormat:ax,targetFormat:a3||aC,userAgent:T,reqLogger:aP,toolNameMap:ao,streamController:a1,onStreamComplete:a7,streamDetailId:a8,pxpipe:a$})}d()}catch(a){d(a)}})},46646:(a,b,c)=>{c.d(b,{Hr:()=>j,nu:()=>h,u9:()=>k,yx:()=>g});var d=c(69152),e=c(30794);let f=new Set(["response.completed","response.done","response.failed","error"]);function g(a,b){return a||(b&&"string"==typeof b.type?b.type:null)}function h(a,b){let c=g(a,b);if(f.has(c))return!0;let d=b?.response?.status;return"completed"===d||"failed"===d}let i=new TextEncoder;function j(){return i.encode(`${k()}data: [DONE]
20
-
21
- `)}function k(){return(0,e.v8)({event:"response.failed",data:{type:"response.failed",response:{id:`resp_${Date.now()}`,status:"failed",error:{type:"stream_error",code:"stream_disconnected",message:"stream closed before response.completed"}}}},d.h.OPENAI_RESPONSES)}},50996:(a,b,c)=>{function d(a,b){let c;if(!a.trim())return;let d=a.match(/^event:\s*(.+)$/m),e=a.match(/^data:\s*(.+)$/m);if(!d||!e)return;let f=d[1].trim(),g=e[1].trim();if("[DONE]"!==g){try{c=JSON.parse(g)}catch{return}"response.created"===f?(b.responseId=c.response?.id||b.responseId,b.created=c.response?.created_at||b.created):"response.output_item.done"===f?b.items.set(c.output_index??0,c.item):"response.completed"===f||"response.done"===f?(b.status="completed",c.response?.usage&&(b.usage.input_tokens=c.response.usage.input_tokens||0,b.usage.output_tokens=c.response.usage.output_tokens||0,b.usage.total_tokens=c.response.usage.total_tokens||0)):"response.failed"===f&&(b.status="failed")}}c.d(b,{I:()=>s,F:()=>r});let e={input_tokens:0,output_tokens:0,total_tokens:0};async function f(a){if(!a||"function"!=typeof a.getReader)return{id:`resp_${Date.now()}`,object:"response",created_at:Math.floor(Date.now()/1e3),status:"failed",output:[],usage:{...e}};let b=new TextDecoder,c="",f={responseId:"",created:Math.floor(Date.now()/1e3),status:"in_progress",usage:{...e},items:new Map};for await(let e of a){let a=(c+=b.decode(e,{stream:!0})).split("\n\n");for(let b of(c=a.pop()||"",a))d(b,f)}c.trim()&&d(c,f);let g=[],h=f.items.size>0?Math.max(...f.items.keys()):-1;for(let a=0;a<=h;a++)g.push(f.items.get(a)||{type:"message",content:[],role:"assistant"});return{id:f.responseId||`resp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,object:"response",created_at:f.created,status:f.status||"completed",output:g,usage:f.usage}}var g=c(15261),h=c(92398),i=c(69152),j=c(13946),k=c(92913),l=c(15204),m=c(14018),n=c(97781),o=c(23648);let p=a=>j.xq[a]?.format===i.h.OPENAI_RESPONSES;function q(a){if(!a?.content||!Array.isArray(a.content))return"";let b=a.content.find(a=>"output_text"===a.type);if("string"==typeof b?.text)return b.text;let c=a.content.find(a=>"string"==typeof a.text);return"string"==typeof c?.text?c.text:""}function r(a,b,c=null){let d=[],e=null;for(let b of String(a||"").split("\n")){let a=b.trim();if(!a.startsWith("data:"))continue;let c=a.slice(5).trim();if(c&&"[DONE]"!==c)try{let a=JSON.parse(c);a?.error?e=a.error:d.push(a)}catch{}}if(e)return{error:e};if(0===d.length)return null;let f=d[0],g=[],h=[],i=new Map,j="stop",k=null;for(let a of d){let b=a?.choices?.[0],c=b?.delta||{};if("string"==typeof c.content&&c.content.length>0&&g.push(c.content),"string"==typeof c.reasoning_content&&c.reasoning_content.length>0&&h.push(c.reasoning_content),b?.finish_reason&&(j=b.finish_reason),a?.usage&&"object"==typeof a.usage&&(k=a.usage),Array.isArray(c.tool_calls))for(let a of c.tool_calls){let b=a.index??0;i.has(b)||i.set(b,{id:a.id||"",type:"function",function:{name:"",arguments:""}});let c=i.get(b);a.id&&(c.id=a.id),a.function?.name&&(c.function.name+=a.function.name),a.function?.arguments&&(c.function.arguments+=a.function.arguments)}}let m={role:"assistant",content:g.join("")||(i.size>0?null:"")};if(h.length>0&&(m.reasoning_content=h.join("")),i.size>0){let a=[...i.entries()].sort((a,b)=>a[0]-b[0]).map(([,a])=>a);if(c&&c.length>0)for(let b of a)b.function?.name&&(b.function.name=(0,l.vh)(b.function.name,c));m.tool_calls=a}let n={id:f.id||`chatcmpl-${Date.now()}`,object:"chat.completion",created:f.created||Math.floor(Date.now()/1e3),model:f.model||b||"unknown",choices:[{index:0,message:m,finish_reason:j}]};return k&&(n.usage=k),n}async function s({providerResponse:a,sourceFormat:b,provider:c,model:d,body:e,stream:j,translatedBody:t,finalBody:u,requestStartTime:v,connectionId:w,apiKey:x,apiKeyName:y,clientRawRequest:z,onRequestSuccess:A,trackDone:B,appendLog:C,comboName:D,toolNameMap:E}){let F=a.headers.get("content-type")||"";if(!(F.includes("text/event-stream")||""===F&&p(c)))return null;B();let G={provider:c,model:d,connectionId:w,apiKey:x,apiKeyName:y,request:(0,k.Fo)(e,j),providerRequest:u||t||null};if(p(c)||b===i.h.OPENAI_RESPONSES)try{let e,g=await f(a.body);A&&await A();let h=g.usage||{};C({tokens:h,status:"200 OK"}),(0,k.qr)({provider:c,model:d,tokens:h,connectionId:w,apiKey:x,endpoint:z?.endpoint,comboName:D});let{msgItem:j,textContent:l}=function(a){if(!Array.isArray(a))return{msgItem:null,textContent:null};let b=a.filter(a=>a?.type==="message");if(0===b.length)return{msgItem:null,textContent:null};for(let a=b.length-1;a>=0;a--){let c=q(b[a]);if(c.length>0)return{msgItem:b[a],textContent:c}}let c=b[b.length-1];return{msgItem:c,textContent:q(c)}}(g.output),p=Date.now()-v;if((0,o.ox)((0,k.$R)({...G,latency:{ttft:p,total:p},tokens:{prompt_tokens:h.input_tokens||0,completion_tokens:h.output_tokens||0},response:{content:l,thinking:null,finish_reason:g.status||"unknown"},status:"success"},{endpoint:z?.endpoint||null})).catch(()=>{}),b===i.h.OPENAI_RESPONSES)return{success:!0,response:new Response(JSON.stringify(g),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})};let r=h.input_tokens||0,s=h.output_tokens||0,t=(g.output||[]).filter(a=>"function_call"===a.type).map((a,b)=>({id:a.call_id||`call_${a.name}_${Date.now()}_${b}`,type:"function",function:{name:a.name,arguments:"string"==typeof a.arguments?a.arguments:JSON.stringify(a.arguments||{})}})),u=t.length>0;if(b===i.h.ANTIGRAVITY||b===i.h.GEMINI||b===i.h.GEMINI_CLI)e={response:{candidates:[{content:{role:"model",parts:[{text:l||""}]},finishReason:"STOP",index:0}],usageMetadata:{promptTokenCount:r,candidatesTokenCount:s,totalTokenCount:r+s},modelVersion:d,responseId:g.id||`resp_${Date.now()}`}};else if(b===i.h.CLAUDE){let a={id:g.id||`chatcmpl-${Date.now()}`,model:g.model||d,choices:[{index:0,message:{role:"assistant",content:l||(u?null:"")},finish_reason:u?"tool_calls":"stop"}],usage:{prompt_tokens:r,completion_tokens:s}};u&&(a.choices[0].message.tool_calls=t);let b=(0,m.DT)(a,d);e=(0,n.kR)(b,E)}else{let a={role:"assistant",content:l||(u?null:"")};u&&(a.tool_calls=t);let b="completed"===g.status||"done"===g.status,c=u?"tool_calls":b?"stop":g.status||"stop";e={id:g.id||`chatcmpl-${Date.now()}`,object:"chat.completion",created:g.created_at||Math.floor(Date.now()/1e3),model:g.model||d,choices:[{index:0,message:a,finish_reason:c}],usage:{prompt_tokens:r,completion_tokens:s,total_tokens:r+s}}}return{success:!0,response:new Response(JSON.stringify(e),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}catch(a){return console.error("[ChatCore] Responses API SSE→JSON failed:",a),(0,g.A1)(h.gx.BAD_GATEWAY,"Failed to convert streaming response to JSON")}try{let f=await a.text(),j=r(f,d,(0,l.Qv)(e?.tools));if(!j)return(0,g.A1)(h.gx.BAD_GATEWAY,"Invalid SSE response for non-streaming request");if(j.error)return(0,g.A1)(h.gx.BAD_GATEWAY,j.error.message||"Upstream SSE stream failed");A&&await A();let p=j.usage||{};C({tokens:p,status:"200 OK"}),(0,k.qr)({provider:c,model:d,tokens:p,connectionId:w,apiKey:x,endpoint:z?.endpoint});let q=Date.now()-v;if((0,o.ox)((0,k.$R)({...G,latency:{ttft:q,total:q},tokens:p,response:{content:j.choices?.[0]?.message?.content||null,thinking:j.choices?.[0]?.message?.reasoning_content||null,finish_reason:j.choices?.[0]?.finish_reason||"unknown"},status:"success"},{endpoint:z?.endpoint||null})).catch(()=>{}),j?.choices)for(let a of j.choices)a?.message?.reasoning_content&&a.message.content&&delete a.message.reasoning_content;let s=j;if(b===i.h.CLAUDE){let a=(0,m.DT)(j,d);s=(0,n.kR)(a,E)}return{success:!0,response:new Response(JSON.stringify(s),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}catch(a){return console.error("[ChatCore] Chat Completions SSE→JSON failed:",a),(0,g.A1)(h.gx.BAD_GATEWAY,"Failed to convert streaming response to JSON")}}},56764:(a,b,c)=>{c.d(b,{U:()=>l});var d=c(5761);let e="You are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written. Before writing code, stop at the first rung that holds: 1. Does this need to exist at all? Speculative need = skip it, say so in one line (YAGNI). 2. Stdlib does it? Use it. 3. Native platform feature covers it? Use it (native input over a picker lib, CSS over JS, DB constraint over app code). 4. Already-installed dependency solves it? Use it. Never add a new dependency for what a few lines can do. 5. Can it be one line? One line. 6. Only then: the minimum code that works.",f="No unrequested abstractions (no interface with one implementation, no factory for one product, no config for a value that never changes). No boilerplate or scaffolding 'for later'. Deletion over addition. Boring over clever. Fewest files possible; shortest working diff wins. Two stdlib options the same size? Take the one correct on edge cases — lazy means less code, not the flimsier algorithm. Mark deliberate simplifications with a `ponytail:` comment naming the ceiling and upgrade path (e.g. `// ponytail: global lock, per-account locks if throughput matters`).",g="Never simplify away: input validation at trust boundaries, error handling that prevents data loss, security, accessibility, or anything explicitly requested. If the user insists on the full version, build it without re-arguing.",h="now is 2026, Be skeptical: never claim 'fixed', 'working', or 'correct' without concrete proof (test output, diff, reproducible verification). If a test passes, verify it tests what you think it tests. Check for side effects. Never fabricate reports ('all tests pass' without running them). Distinguish pre-existing bugs from ones you caused — run tests BEFORE and AFTER, diff the results. Report honestly: if broken and can't fix, say so. If skipped, explain why. If caveats, state them. Verify before declaring done — run relevant tests AFTER changes, show actual output.",i="Code first. Then at most three short lines: what was skipped and when to add it. Pattern: [code] then skipped: [X], add when [Y]. If the explanation is longer than the code, delete the explanation.",j="ACTIVE EVERY RESPONSE. No drift back to over-building. Still active if unsure.",k={lite:[e,"Level: lite. Build what's asked, but name the lazier alternative in one line — the user picks.",f,i,g,h,j].join(" "),full:[e,"Level: full. The ladder is enforced — stdlib and native first, shortest diff, shortest explanation. Ship the lazy version and question unrequested scope in the same response.",f,i,g,h,j].join(" "),ultra:[e,"Level: ultra. YAGNI extremist. Deletion before addition. Ship the one-liner and challenge the rest of the requirement in the same breath. No feature until a profiler or a real requirement demands it.",f,i,g,h,j].join(" ")};function l(a,b,c){(0,d.J)(a,b,k[c])}},60137:(a,b,c)=>{c.d(b,{$:()=>r,M:()=>q});var d=c(69152),e=c(56974),f=c(67860),g=c(77380),h=c(78963),i=c(13946),j=c(92398),k=c(46646),l=c(92913),m=c(23648),n=c(2933);async function o(a){if(!a||"function"!=typeof a.getReader)return{empty:!0};let b=a.getReader();try{let{done:a,value:c}=await b.read();if(a)return{empty:!0};return{empty:!1,firstChunk:c,reader:b}}catch(a){throw b.cancel?.().catch(()=>{}),a}}let p={[d.h.OPENAI_RESPONSES]:d.h.OPENAI_RESPONSES,[d.h.CLAUDE]:d.h.CLAUDE,[d.h.ANTIGRAVITY]:d.h.ANTIGRAVITY,[d.h.GEMINI]:d.h.ANTIGRAVITY,[d.h.GEMINI_CLI]:d.h.ANTIGRAVITY};async function q({providerResponse:a,provider:b,model:c,sourceFormat:r,targetFormat:s,userAgent:t,body:u,stream:v,translatedBody:w,finalBody:x,requestStartTime:y,connectionId:z,apiKey:A,apiKeyName:B,clientRawRequest:C,onRequestSuccess:D,reqLogger:E,toolNameMap:F,streamController:G,onStreamComplete:H,streamDetailId:I,pxpipe:J}){let K;D&&Promise.resolve().then(D).catch(a=>{console.error("[ChatCore] onRequestSuccess failed:",a?.message||a)});let L=(a.headers.get("content-type")||"").toLowerCase();!L||L.includes("text/event-stream")||L.includes("application/json")||console.warn("[STREAM] "+b+" | "+c+" | unexpected Content-Type: "+L);try{K=await o(a.body)}catch(a){return{success:!1,status:502,errorCode:"STREAM_EARLY_EOF",error:a?.message||String(a)}}if(K.empty)return{success:!1,status:502,errorCode:"STREAM_EARLY_EOF",error:"Upstream closed stream before any useful content"};let M=function({provider:a,sourceFormat:b,targetFormat:c,userAgent:h,reqLogger:j,toolNameMap:k,model:l,connectionId:m,body:n,onStreamComplete:o,apiKey:q}){let r=h?.toLowerCase().includes("droid")||h?.toLowerCase().includes("codex-cli"),s=i.xq[a]?.format===d.h.OPENAI_RESPONSES&&c===d.h.OPENAI_RESPONSES&&!r,t=/kimi-k2\./i.test(l||"");if(s){let c=p[b]||d.h.OPENAI;return(0,f.i5)(d.h.OPENAI_RESPONSES,c,a,j,k,l,m,n,o,q,t?g.vH:null)}return(0,e.nZ)(c,b)?(0,f.i5)(c,b,a,j,k,l,m,n,o,q,t?g.vH:null):(0,f.l2)(a,j,l,m,n,o,q,t?g.vH:null)}({provider:b,sourceFormat:r,targetFormat:s,userAgent:t,reqLogger:E,toolNameMap:F,model:c,connectionId:z,body:u,onStreamComplete:H,apiKey:A}),N=r===d.h.OPENAI_RESPONSES&&s===d.h.OPENAI_RESPONSES?k.Hr:null,O=i.xq[b]?.stallTimeoutMs||j.xM,P=new Response(function({firstChunk:a,reader:b}){let c=!1;return new ReadableStream({async pull(d){if(!c){d.enqueue(a),c=!0;return}try{let{done:a,value:c}=await b.read();a?(d.close(),b.releaseLock?.()):d.enqueue(c)}catch(a){d.error(a),b.cancel?.().catch(()=>{})}},cancel(a){b.cancel?.(a).catch(()=>{})}})}(K),{status:a.status,statusText:a.statusText,headers:a.headers}),Q=(0,h.Jb)(P,M,G,N,O);return(0,m.ox)((0,l.$R)({provider:b,model:c,connectionId:z,apiKey:A,apiKeyName:B,latency:{ttft:0,total:Date.now()-y},tokens:{prompt_tokens:0,completion_tokens:0},request:(0,l.Fo)(u,v),providerRequest:x||w||null,providerResponse:"[Streaming - raw response not captured]",response:{content:"[Streaming in progress...]",thinking:null,type:"streaming"},pxpipe:J,status:"success"},{id:I})).catch(a=>{console.error("[RequestDetail] Failed to save streaming request:",a.message)}),{success:!0,response:new Response(Q,{headers:n.RK})}}function r({provider:a,model:b,connectionId:c,apiKey:d,apiKeyName:e,requestStartTime:f,body:g,stream:h,finalBody:i,translatedBody:j,clientRawRequest:k,pxpipe:n}){let o=`${Date.now()}-${Math.random().toString(36).slice(2,11)}`;return{onStreamComplete:(p,q,r)=>{let s={ttft:r?r-f:Date.now()-f,total:Date.now()-f},t=p?.content||"[Empty streaming response]",u=p?.thinking||null;(0,m.ox)((0,l.$R)({provider:a,model:b,connectionId:c,apiKey:d,apiKeyName:e,latency:s,tokens:q||{prompt_tokens:0,completion_tokens:0},request:(0,l.Fo)(g,h),providerRequest:i||j||null,providerResponse:t,response:{content:t,thinking:u,type:"streaming"},pxpipe:n,status:"success"},{id:o})).catch(a=>{console.error("[RequestDetail] Failed to update streaming content:",a.message)}),(0,l.qr)({provider:a,model:b,tokens:q,connectionId:c,apiKey:d,endpoint:k?.endpoint,label:"STREAM USAGE"})},streamDetailId:o}}},61210:(a,b,c)=>{c.d(b,{F:()=>g});let d=[{triggers:["mcp__exa__web_search_exa","mcp__exa__web_fetch_exa"],strip:["WebSearch","WebFetch","mcp__workspace__web_fetch"]},{triggers:["mcp__tavily__tavily_search","mcp__tavily__tavily_extract"],strip:["WebSearch","WebFetch","mcp__workspace__web_fetch"]},{triggers:[/^mcp__browsermcp__/],strip:[/^mcp__Claude_in_Chrome__/]}];function e(a){return a?.name||a?.function?.name||""}function f(a,b){return"string"==typeof b?a===b:b instanceof RegExp&&b.test(a)}function g(a){if(!Array.isArray(a)||0===a.length)return{tools:a,stripped:[]};let b=a.map(e),c=new Set;for(let a of d)if(b.some(b=>a.triggers.some(a=>f(b,a))))for(let d of b)a.strip.some(a=>f(d,a))&&c.add(d);return 0===c.size?{tools:a,stripped:[]}:{tools:a.filter(a=>!c.has(e(a))),stripped:Array.from(c)}}},63192:(a,b,c)=>{c.d(b,{p:()=>n});var d=c(5761);let e="Code blocks, file paths, commands, errors, URLs: keep exact. Security warnings, irreversible action confirmations, multi-step ordered sequences: write normal. Resume terse style after.",f='Not: "Sure! I\'d be happy to help you with that. The issue you\'re experiencing is likely caused by..." Yes: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"',g="Auto-Clarity: drop caveman for security warnings, irreversible actions, multi-step sequences where fragment ambiguity risks misread, or when user repeats a question. Resume after the clear part.",h="ACTIVE EVERY RESPONSE. No revert after many turns. No filler drift. Still active if unsure.",i="No invented abbreviations. Standard well-known tech acronyms (DB, API, HTTP, URL, JSON, ID, OS, CPU) OK. Names of code symbols, function names, API names, error strings: keep verbatim.",j="Preserve the user's dominant language. User wrote Vietnamese, reply Vietnamese. User wrote English, reply English. Wenyan/classical-Chinese levels override this language-preservation rule. Code identifiers, error strings, file paths, commands: keep in their original form regardless of language.",k='No self-reference. Do not name or announce the style (no "caveman mode", no "me caveman think", no "compressed mode active"). Just respond.',l='No decorative emoji. No narrating tool calls ("I will now search", "I used X to find Y"). No status phrases ("Sure!", "Of course!", "I\'d be happy to"). No causal arrow shorthand ("A -> B -> fails"). State the thing, the action, the reason. Then next step.',m={lite:["Respond tersely. Keep grammar and full sentences but drop filler, hedging and pleasantries (just/really/basically/sure/of course/I'd be happy to). Pattern: state the thing, the action, the reason. Then next step.",f,e,g,h,i,j,k,l].join(" "),full:["Respond like terse caveman. All technical substance stay exact, only fluff die. Drop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries, hedging. Fragments OK. Short synonyms (big not extensive, fix not implement a solution for). Pattern: [thing] [action] [reason]. [next step].",f,e,g,h,i,j,k,l].join(" "),ultra:["Respond ultra-terse. Maximum compression. Telegraphic. Strip conjunctions. One word when one word enough. Pattern: [thing] [action] [reason]. [next step].",f,e,g,h,i,j,k,l].join(" "),"wenyan-lite":["Respond semi-classical. Drop filler/hedging but keep grammar structure, classical register. Use classical Chinese sentence patterns where natural. Keep English for technical terms.",f,e,g,h,i,j,k,l].join(" "),wenyan:["Respond classical Chinese (æ–‡č¨€æ–‡). Maximum classical terseness. 80-90% character reduction. Classical sentence patterns, verbs precede objects, subjects often omitted, classical particles (之/䚃/į‚ē/å…ļ). Keep English for code, commands, function names, API names, error strings.",f,e,g,h,i,j,k,l].join(" "),"wenyan-ultra":["Respond extreme classical compression (æ–‡č¨€æ–‡ ultra). Maximum compression, ultra terse. Same classical rules as wenyan-full but even more compressed. One classical particle per clause.",f,e,g,h,i,j,k,l].join(" ")};function n(a,b,c){(0,d.J)(a,b,m[c])}},67860:(a,b,c)=>{c.d(b,{i5:()=>q,l2:()=>r,lm:()=>g.lm,v8:()=>h.v8});var d=c(56974),e=c(69152),f=c(23648),g=c(73329),h=c(30794),i=c(46646),j=c(25440),k=c(15204);function l(a,b,c,d,f,g){var i;if(!b||0===b.length||f!==e.h.OPENAI)return!1;let j=(i=c?.messageId,{id:i?.startsWith("chatcmpl-")?i:`chatcmpl-${i||Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:d||null,choices:[{index:0,delta:{tool_calls:b},finish_reason:"tool_calls"}]}),k=(0,h.v8)(j,e.h.OPENAI);return g?.appendConvertedChunk?.(k),a.enqueue(m.encode(k)),!0}c(2933);let m=new TextEncoder,n="translate",o="passthrough";function p(a={}){let{mode:b=n,targetFormat:c,sourceFormat:q,provider:r=null,reqLogger:s=null,toolNameMap:t=null,model:u=null,connectionId:v=null,body:w=null,onStreamComplete:x=null,apiKey:y=null,normalizeKimiToolCalls:z=null}=a,A="",B=null,C=w?.tools?(0,k.Qv)(w.tools):null,D=new TextDecoder("utf-8",{fatal:!1}),E=b===n?{...(0,d.Ws)(q),provider:r,toolNameMap:t,model:u}:null,F=0,G="",H="",I=null,J=0,K=0,L={},M=/kimi-k2\./i.test(u||""),N=null,O=!1,P=null,Q=!1,R=!1,S=!1;return new TransformStream({transform(a,f){I||(I=Date.now());let p=D.decode(a,{stream:!0});A+=p,s?.appendProviderChunk?.(p);let r=A.split("\n");for(let a of(A=r.pop()||"",r)){let p=a.trim();if(j.T&&p&&(J++,p.startsWith("event:"))){let a=p.slice(6).trim();L[a]=(L[a]||0)+1}if(b===n&&c===e.h.OPENAI_RESPONSES&&p.startsWith("event:")&&(P=p.slice(6).trim()),b===o){let b,c=!1;if(p.startsWith("data:")&&"[DONE]"!==p.slice(5).trim())try{let a=JSON.parse(p.slice(5).trim()),d=(0,h.A4)(a),f=!1;if(void 0!==a.choices&&(a.object||(a.object="chat.completion.chunk",f=!0),a.created||(a.created=Math.floor(Date.now()/1e3),f=!0)),void 0!==a.prompt_filter_results&&(delete a.prompt_filter_results,f=!0),a?.choices)for(let b of a.choices)void 0!==b.content_filter_results&&(delete b.content_filter_results,f=!0);if(C&&C.length>0&&Array.isArray(a.choices))for(let b of a.choices){let a=b?.delta;if(Array.isArray(a?.tool_calls)){for(let b of a.tool_calls)if(b.function?.name){let a=(0,k.vh)(b.function.name,C);a!==b.function.name&&(b.function.name=a,f=!0)}}}if(a?.choices)for(let b of a.choices)b.delta?.tool_calls&&Array.isArray(b.delta.tool_calls)&&0===b.delta.tool_calls.length&&(delete b.delta.tool_calls,f=!0);if(!(0,h.c2)(a,e.h.OPENAI))continue;let i=a.choices?.[0]?.delta,j=i?.content,l=i?.reasoning_content;j&&"string"==typeof j&&(F+=j.length,G+=j),l&&"string"==typeof l&&(F+=l.length,H+=l);let m=(0,g.f5)(a);m&&(B=(0,g._L)(B,m));let n=a.choices?.[0]?.finish_reason;if(n&&!(0,g.Gh)(a.usage)){let d=(0,g.OF)(w,F,e.h.OPENAI);a.usage=(0,g.WL)(d,e.h.OPENAI),b=`data: ${JSON.stringify(a)}
19
+ [ROUTER NOTE: ${f.hint}]`;"string"==typeof a.content?a.content.includes("[ROUTER NOTE:")||(a.content+=b):Array.isArray(a.content)?a.content.some(a=>a.text&&a.text.includes("[ROUTER NOTE:"))||a.content.push({type:"text",text:b}):a.content=b.trimStart()}}e?.warn?.("LOOPGUARD",`${c}/${d} | loop detected, hint injected`)}(an,aS,at,au,d),/(?:^|[/_-])kimi(?:[/_-]|$)|(?:^|[/_-])kimi-k2\.(?:6|7)(?:\b|[-_/])/i.test(`${at}/${au}`)&&((0,G.sH)(an,aS),d?.debug?.("TERMINATION",`${at}/${au} | ${aS}`)),aj?.mode&&"auto"!==aj.mode){let a=(0,J.nl)(at,au);if(a?.reasoning){let b=aj.mode;"off"===b?(an.reasoning_effort="none",!1!==a.thinkingCanDisable&&(an.thinking={type:"disabled"}),d?.debug?.("THINKING",`${at}/${au} | disabled`)):"on"===b?(an.thinking={type:"enabled",budget_tokens:1e4},d?.debug?.("THINKING",`${at}/${au} | enabled (10k budget)`)):(an.reasoning_effort=b,d?.debug?.("THINKING",`${at}/${au} | effort=${b}`))}}let a$=null;if(ad){let a=await (0,e.H)(an,{enabled:!0,format:aS,model:aE,minChars:ae,timeoutMs:af,transform:ag});a$=a.summary,a.body&&(an=a.body);let b=(0,e._)(a$);b?d?.info?.("PXPIPE",b):d?.debug?.("PXPIPE",`skipped: ${a$.reason}${a$.detail?` (${a$.detail})`:""}`);try{ah?.({provider:at,model:au,...a$})}catch{}}let a_=(0,u.SB)(at);(0,t.uw)(au,at,S,!0),(0,t.E5)({model:au,provider:at,connectionId:S,status:"PENDING"}).catch(()=>{});let a0=an.messages?.length||an.input?.length||an.contents?.length||an.request?.contents?.length||0;d?.debug?.("REQUEST",`${at.toUpperCase()} | ${au} | ${a0} msgs`);let a1=(0,k.jd)({onDisconnect:a=>{(0,t.uw)(au,at,S,!1),Q&&Q(a)},onError:()=>(0,t.uw)(au,at,S,!1),log:d,provider:at,model:au});ak&&(ak.aborted?a1.abort():ak.addEventListener("abort",()=>a1.abort(),{once:!0}));let a2={connectionProxyEnabled:c?.providerSpecificData?.connectionProxyEnabled===!0,connectionProxyUrl:c?.providerSpecificData?.connectionProxyUrl||"",connectionNoProxy:c?.providerSpecificData?.connectionNoProxy||"",vercelRelayUrl:c?.providerSpecificData?.vercelRelayUrl||""};if(a2.vercelRelayUrl){let a=c?.connectionName||c?.connectionId||"unknown",b=c?.providerSpecificData?.connectionProxyPoolId||"none";d?.info?.("PROXY",`${at.toUpperCase()} | ${au} | conn=${a} | pool=${b} | vercel-relay=${a2.vercelRelayUrl}`)}else if(a2.connectionProxyEnabled&&a2.connectionProxyUrl){let a=a2.connectionProxyUrl;try{let b=new URL(a2.connectionProxyUrl),c=b.hostname||"",d=b.port?`:${b.port}`:"",e=b.protocol||"http:";a=`${e}//${c}${d}`}catch{}let b=c?.providerSpecificData?.connectionProxyPoolId||"none",e=c?.connectionName||c?.connectionId||"unknown";d?.info?.("PROXY",`${at.toUpperCase()} | ${au} | conn=${e} | pool=${b} | url=${a}`)}if(a2.connectionProxyEnabled&&a2.connectionNoProxy){let a=c?.connectionName||c?.connectionId||"unknown";d?.debug?.("PROXY",`${at.toUpperCase()} | ${au} | conn=${a} | no_proxy=${a2.connectionNoProxy}`)}let a3=aC;try{let a=await a_.execute({model:au,body:an,stream:aJ,credentials:c,signal:a1.signal,log:d,proxyOptions:a2,accountCount:av});ap=a.response,aq=a.url,ar=a.headers,as=a.transformedBody,a3=a.responseFormat||aC,aP.logTargetRequest(aq,ar,as)}catch(c){if((0,t.uw)(au,at,S,!1,!0),(0,t.E5)({model:au,provider:at,connectionId:S,status:`FAILED ${"AbortError"===c.name?499:r.gx.BAD_GATEWAY}`}).catch(()=>{}),(0,t.ox)((0,w.$R)({provider:at,model:au,connectionId:S,apiKey:U,apiKeyName:V,latency:{ttft:0,total:Date.now()-aw},tokens:{prompt_tokens:0,completion_tokens:0},request:(0,w.Fo)(a,aJ),providerRequest:an||null,response:{error:c.message||String(c),status:"AbortError"===c.name?499:502,thinking:null},pxpipe:a$,status:"error"})).catch(()=>{}),"AbortError"===c.name)return a1.handleError(c),(0,q.A1)(499,"Request aborted");let b=(0,q.lR)(c,at,au,r.gx.BAD_GATEWAY);return console.log(`${j.lm.red}[ERROR] ${b}${j.lm.reset}`),(0,q.A1)(r.gx.BAD_GATEWAY,b)}if(!a_.noAuth&&(ap.status===r.gx.UNAUTHORIZED||ap.status===r.gx.FORBIDDEN))try{let a=await (0,l.qZ)(()=>a_.refreshCredentials(c,d),3,d);if(a?.accessToken||a?.copilotToken){if(d?.info?.("TOKEN",`${at.toUpperCase()} | refreshed`),Object.assign(c,a),M)try{await M(a)}catch(a){d?.warn?.("TOKEN",`onCredentialsRefreshed failed: ${a.message}`)}try{let a=await a_.execute({model:au,body:an,stream:aJ,credentials:c,signal:a1.signal,log:d,proxyOptions:a2,accountCount:av});a.response.ok&&(ap=a.response,aq=a.url,a3=a.responseFormat||aC)}catch{d?.warn?.("TOKEN",`${at.toUpperCase()} | retry after refresh failed`)}}else d?.warn?.("TOKEN",`${at.toUpperCase()} | refresh failed`)}catch(a){d?.warn?.("TOKEN",`${at.toUpperCase()} | refresh threw: ${a.message}`)}if(!ap.ok){(0,t.uw)(au,at,S,!1,!0);let{statusCode:b,message:c,resetsAtMs:d}=await (0,q.zL)(ap,a_);(0,t.E5)({model:au,provider:at,connectionId:S,status:`FAILED ${b}`}).catch(()=>{}),(0,t.ox)((0,w.$R)({provider:at,model:au,connectionId:S,apiKey:U,apiKeyName:V,latency:{ttft:0,total:Date.now()-aw},tokens:{prompt_tokens:0,completion_tokens:0},request:(0,w.Fo)(a,aJ),providerRequest:as||an||null,response:{error:c,status:b,thinking:null},pxpipe:a$,status:"error"})).catch(()=>{});let e=(0,q.lR)(Error(c),at,au,b);return console.log(`${j.lm.red}[ERROR] ${e}${j.lm.reset}`),aP.logError(Error(c),as||an),(0,q.A1)(b,e,d)}let a4={provider:at,model:au,body:a,stream:aH,translatedBody:an,finalBody:as,requestStartTime:aw,connectionId:S,apiKey:U,apiKeyName:V,clientRawRequest:R,onRequestSuccess:P,pxpipe:a$},a5=a=>(0,t.E5)({model:au,provider:at,connectionId:S,...a}).catch(()=>{}),a6=()=>(0,t.uw)(au,at,S,!1);if(aI&&aF){let a=await (0,y.NE)({...a4,stream:aJ,providerResponse:ap,sourceFormat:ax,targetFormat:aC,reqLogger:aP,toolNameMap:ao,trackDone:a6,appendLog:a5});if(!a.success)return a;let b=await a.response.json(),c=(0,A.y)(b);return a1.handleComplete(),{success:!0,response:c}}if(!aF&&aG){let a=await (0,x.I)({...a4,providerResponse:ap,sourceFormat:ax,toolNameMap:ao,trackDone:a6,appendLog:a5});if(a)return a1.handleComplete(),a}if(!aH){let a=await (0,y.NE)({...a4,providerResponse:ap,sourceFormat:ax,targetFormat:a3||aC,reqLogger:aP,toolNameMap:ao,trackDone:a6,appendLog:a5});if("clinepass"===at&&!a?.success&&/empty/i.test(a?.error||"")){d?.warn?.("RETRY","clinepass returned empty content, retrying once after 2s"),await new Promise(a=>setTimeout(a,2e3));try{let b=await a_.execute({model:au,body:an,stream:!1,credentials:c,signal:a1.signal,log:d,proxyOptions:a2});b?.response?.ok&&(ap=b.response,a=await (0,y.NE)({...a4,providerResponse:ap,sourceFormat:ax,targetFormat:a3||aC,reqLogger:aP,toolNameMap:ao,trackDone:a6,appendLog:a5}))}catch(a){d?.warn?.("RETRY",`clinepass retry failed: ${a.message}`)}}return a1.handleComplete(),a}let{onStreamComplete:a7,streamDetailId:a8}=(0,z.$)({...a4});return(0,z.M)({...a4,providerResponse:ap,sourceFormat:ax,targetFormat:a3||aC,userAgent:T,reqLogger:aP,toolNameMap:ao,streamController:a1,onStreamComplete:a7,streamDetailId:a8,pxpipe:a$})}d()}catch(a){d(a)}})},45479:(a,b,c)=>{c.d(b,{i5:()=>q,l2:()=>r,lm:()=>g.lm,v8:()=>h.v8});var d=c(56974),e=c(69152),f=c(23648),g=c(73329),h=c(30794),i=c(46646),j=c(25440),k=c(15204);function l(a,b,c,d,f,g){var i;if(!b||0===b.length||f!==e.h.OPENAI)return!1;let j=(i=c?.messageId,{id:i?.startsWith("chatcmpl-")?i:`chatcmpl-${i||Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:d||null,choices:[{index:0,delta:{tool_calls:b},finish_reason:"tool_calls"}]}),k=(0,h.v8)(j,e.h.OPENAI);return g?.appendConvertedChunk?.(k),a.enqueue(m.encode(k)),!0}c(2933);let m=new TextEncoder,n="translate",o="passthrough";function p(a={}){let{mode:b=n,targetFormat:c,sourceFormat:q,provider:r=null,reqLogger:s=null,toolNameMap:t=null,model:u=null,connectionId:v=null,body:w=null,onStreamComplete:x=null,apiKey:y=null,normalizeKimiToolCalls:z=null}=a,A="",B=null,C=w?.tools?(0,k.Qv)(w.tools):null,D=new TextDecoder("utf-8",{fatal:!1}),E=b===n?{...(0,d.Ws)(q),provider:r,toolNameMap:t,model:u}:null,F=0,G="",H="",I=null,J=0,K=0,L={},M=/kimi-k2\./i.test(u||""),N=null,O=!1,P=null,Q=!1,R=!1,S=!1;return new TransformStream({transform(a,f){I||(I=Date.now());let p=D.decode(a,{stream:!0});A+=p,s?.appendProviderChunk?.(p);let r=A.split("\n");for(let a of(A=r.pop()||"",r)){let p=a.trim();if(j.T&&p&&(J++,p.startsWith("event:"))){let a=p.slice(6).trim();L[a]=(L[a]||0)+1}if(b===n&&c===e.h.OPENAI_RESPONSES&&p.startsWith("event:")&&(P=p.slice(6).trim()),b===o){let b,c=!1;if(p.startsWith("data:")&&"[DONE]"!==p.slice(5).trim())try{let a=JSON.parse(p.slice(5).trim()),d=(0,h.A4)(a),f=!1;if(void 0!==a.choices&&(a.object||(a.object="chat.completion.chunk",f=!0),a.created||(a.created=Math.floor(Date.now()/1e3),f=!0)),void 0!==a.prompt_filter_results&&(delete a.prompt_filter_results,f=!0),a?.choices)for(let b of a.choices)void 0!==b.content_filter_results&&(delete b.content_filter_results,f=!0);if(C&&C.length>0&&Array.isArray(a.choices))for(let b of a.choices){let a=b?.delta;if(Array.isArray(a?.tool_calls)){for(let b of a.tool_calls)if(b.function?.name){let a=(0,k.vh)(b.function.name,C);a!==b.function.name&&(b.function.name=a,f=!0)}}}if(a?.choices)for(let b of a.choices)b.delta?.tool_calls&&Array.isArray(b.delta.tool_calls)&&0===b.delta.tool_calls.length&&(delete b.delta.tool_calls,f=!0);if(!(0,h.c2)(a,e.h.OPENAI))continue;let i=a.choices?.[0]?.delta,j=i?.content,l=i?.reasoning_content;j&&"string"==typeof j&&(F+=j.length,G+=j),l&&"string"==typeof l&&(F+=l.length,H+=l);let m=(0,g.f5)(a);m&&(B=(0,g._L)(B,m));let n=a.choices?.[0]?.finish_reason;if(n&&!(0,g.Gh)(a.usage)){let d=(0,g.OF)(w,F,e.h.OPENAI);a.usage=(0,g.WL)(d,e.h.OPENAI),b=`data: ${JSON.stringify(a)}
22
20
  `,B=d,c=!0}else if(n&&B){let d=(0,g.O9)(B);a.usage=(0,g.WL)(d,e.h.OPENAI),b=`data: ${JSON.stringify(a)}
23
21
  `,c=!0}else(d||f)&&(b=`data: ${JSON.stringify(a)}
24
- `,c=!0)}catch{continue}c||(b=a.startsWith("data:")&&!a.startsWith("data: ")?"data: "+a.slice(5)+"\n":a+"\n"),s?.appendConvertedChunk?.(b),f.enqueue(m.encode(b));continue}if(!p)continue;let r=(0,h.tV)(p,c);if(!r)continue;let t=c===e.h.OPENAI_RESPONSES,v=t&&q===e.h.OPENAI_RESPONSES,x=t?(0,i.yx)(P,r):null;if(t&&(0,i.nu)(x,r)&&(Q=!0),r&&r.done&&c!==e.h.OLLAMA){if(v&&!Q){let a=(0,i.u9)();s?.appendConvertedChunk?.(a),f.enqueue(m.encode(a)),Q=!0,K++}if(v&&!S){let a="data: [DONE]\n\n";s?.appendConvertedChunk?.(a),f.enqueue(m.encode(a))}S=!0,v&&(R=!0);continue}if(r.delta?.text&&(F+=r.delta.text.length,G+=r.delta.text),r.delta?.thinking&&(F+=r.delta.thinking.length,H+=r.delta.thinking),r.choices?.[0]?.delta?.content&&(F+=r.choices[0].delta.content.length,G+=r.choices[0].delta.content),M&&z&&r.choices?.[0]?.delta?.content){let a=r.choices[0].delta.content,{message:b,hasTools:c}=z({role:"assistant",content:a});c&&(N=b.tool_calls,r.choices[0].delta.content=b.content||void 0,r.choices[0].delta.content||delete r.choices[0].delta.content,F-=a.length,G=G.slice(0,G.length-a.length),b.content&&(F+=b.content.length,G+=b.content))}if(r.choices?.[0]?.delta?.reasoning_content&&(F+=r.choices[0].delta.reasoning_content.length,H+=r.choices[0].delta.reasoning_content),r.candidates?.[0]?.content?.parts)for(let a of r.candidates[0].content.parts)a.text&&"string"==typeof a.text&&(F+=a.text.length,!0===a.thought?H+=a.text:G+=a.text);let y=(0,g.f5)(r);if(y&&(E.usage=(0,g._L)(E.usage,y)),v&&x){let a=(0,h.v8)({event:x,data:r},q);s?.appendConvertedChunk?.(a),f.enqueue(m.encode(a)),P=null,K++;continue}P=null;let A=(0,d.Y8)(c,q,r,E);if(A?._openaiIntermediate)for(let a of A._openaiIntermediate){let b=(0,h.v8)(a,e.h.OPENAI);s?.appendOpenAIChunk?.(b)}if(A?.length>0)for(let a of A){if(null==a)continue;let b="message_delta"===a.type||a.choices?.[0]?.finish_reason;if(N&&b&&q===e.h.OPENAI){l(f,N,E,u,q,s)&&(K++,O=!0);continue}if(!(0,h.c2)(a,q))continue;if(E.finishReason&&b&&!(0,g.Gh)(a.usage)&&F>0){let b=(0,g.OF)(w,F,q);a.usage=(0,g.WL)(b,q),E.usage=b}else if(E.finishReason&&b&&E.usage){let b=(0,g.O9)(E.usage);a.usage=(0,g.WL)(b,q)}let c=(0,h.v8)(a,q);s?.appendConvertedChunk?.(c),f.enqueue(m.encode(c)),K++}}},flush(a){let k=Object.entries(L).map(([a,b])=>`${a}=${b}`).join(",")||"none";(0,j.s)("SSE",`flush | provider=${r} | model=${u} | recvLines=${J} | emitted=${K} | events=[${k}]`),(0,f.uw)(u,r,v,!1);try{let j=D.decode();if(j&&(A+=j),b===o){if(A){let b=A;A.startsWith("data:")&&!A.startsWith("data: ")&&(b="data: "+A.slice(5)),s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b))}!(0,g.Gh)(B)&&F>0&&(B=(0,g.OF)(w,F,e.h.OPENAI)),(0,g.Gh)(B)?(0,g.IF)(r,B,u,v,y):(0,f.E5)({model:u,provider:r,connectionId:v,tokens:null,status:"200 OK"}).catch(()=>{});let b="antigravity"===r||"gemini"===r||"vertex"===r;if(!S&&!b){let b="data: [DONE]\n\n";s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b))}x&&x({content:G,thinking:H},B,I);return}if(A.trim()){let b=(0,h.tV)(A.trim());if(b&&!b.done){let f=(0,d.Y8)(c,q,b,E);if(f?._openaiIntermediate)for(let a of f._openaiIntermediate){let b=(0,h.v8)(a,e.h.OPENAI);s?.appendOpenAIChunk?.(b)}if(f?.length>0)for(let b of f){if(null==b)continue;let c=(0,h.v8)(b,q);s?.appendConvertedChunk?.(c),a.enqueue(m.encode(c))}}}let k=(0,d.Y8)(c,q,null,E);if(k?._openaiIntermediate)for(let a of k._openaiIntermediate){let b=(0,h.v8)(a,e.h.OPENAI);s?.appendOpenAIChunk?.(b)}if(k?.length>0)for(let b of k){if(null==b)continue;let c=(0,h.v8)(b,q);s?.appendConvertedChunk?.(c),a.enqueue(m.encode(c))}if(!O&&M&&z){let{hasTools:b,message:c}=z({role:"assistant",content:G});b&&l(a,c.tool_calls,E,u,q,s)&&(K++,O=!0)}let n=c===e.h.OPENAI_RESPONSES&&q===e.h.OPENAI_RESPONSES;if(n&&!Q){let b=(0,i.u9)();s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b)),Q=!0}if(n&&!R&&!S){let b="data: [DONE]\n\n";s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b)),R=!0,S=!0}!(0,g.Gh)(E?.usage)&&F>0&&(E.usage=(0,g.OF)(w,F,q)),(0,g.Gh)(E?.usage)?(0,g.IF)(E.provider||c,E.usage,u,v,y):(0,f.E5)({model:u,provider:r,connectionId:v,tokens:null,status:"200 OK"}).catch(()=>{}),x&&x({content:G,thinking:H},E?.usage,I)}catch(a){console.log("Error in flush:",a)}}})}function q(a,b,c=null,d=null,e=null,f=null,g=null,h=null,i=null,j=null,k=null){return p({mode:n,targetFormat:a,sourceFormat:b,provider:c,reqLogger:d,toolNameMap:e,model:f,connectionId:g,body:h,onStreamComplete:i,apiKey:j,normalizeKimiToolCalls:k})}function r(a=null,b=null,c=null,d=null,e=null,f=null,g=null,h=null){return p({mode:o,provider:a,reqLogger:b,model:c,connectionId:d,body:e,onStreamComplete:f,apiKey:g,normalizeKimiToolCalls:h})}},69188:(a,b,c)=>{c.d(b,{Nv:()=>m,O2:()=>n,SI:()=>l,cB:()=>o});var d=c(48117),e=c(40657),f=c(59463);function g(a){try{return new TextEncoder().encode(JSON.stringify(a)||"").length}catch{return 0}}function h(a){let b=function(a){if(Array.isArray(a?.messages))return a.messages;if(Array.isArray(a?.input))return a.input;let b=j(a);return b?b.messages:null}(a);return{bodyBytes:g(a),messageBytes:b?g(b):0}}function i(a,b){a&&!a.reason&&(a.reason=b)}function j(a){let b=a?.conversationState;if(!b||"object"!=typeof b)return null;let c=[],d=[],e=(a,b,e,f={})=>{"string"==typeof b&&(c.push({role:a,content:b,...f}),d.push(e))},f=a=>{let b=a?.userInputMessage;if(b){e("system",b.systemInstruction,{object:b,key:"systemInstruction"}),e("user",b.content,{object:b,key:"content"});let a=b.userInputMessageContext?.toolResults;if(Array.isArray(a))for(let b of a){let a=b?.content;if(Array.isArray(a))for(let c of a)e("tool",c?.text,{object:c,key:"text"},b?.toolUseId?{tool_call_id:b.toolUseId}:{})}return}let c=a?.assistantResponseMessage;if(c){let a=(a=>{if(!Array.isArray(a)||0===a.length)return;let b=a.map(a=>({id:a?.toolUseId,type:"function",function:{name:a?.name||"",arguments:JSON.stringify(a?.input||{})}})).filter(a=>a.id||a.function.name);return b.length>0?b:void 0})(c.toolUses);e("assistant",c.content,{object:c,key:"content"},a?{tool_calls:a}:{})}};if(Array.isArray(b.history))for(let a of b.history)f(a);return b.currentMessage&&f(b.currentMessage),c.length>0?{messages:c,targets:d}:null}async function k(a,b,c,d,e,f){let g,h=function(a){try{let b=new URL(a);return b.pathname=`${b.pathname.replace(/\/$/,"")}/v1/compress`,b.hash="",b.toString()}catch{let[b,c=""]=String(a).replace(/#.*$/,"").split("?",2),d=`${b.replace(/\/$/,"")}/v1/compress`;return c?`${d}?${c}`:d}}(a);f.endpoint=function(a){try{let b=new URL(a);return b.username="",b.password="",b.search="",b.hash="",b.toString()}catch{return String(a).replace(/\/\/[^/@\s]+@/,"//").replace(/[?#].*$/,"")}}(h);let j={messages:b,model:c};e&&(j.config={compress_user_messages:!0});try{g=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),signal:AbortSignal.timeout(d)})}catch(d){var k;let a,b,c;return i(f,`request failed: ${(k=d,a=k?.cause,b=a?.code||k?.code,c=String(a?.message||k?.message||String(k)).replace(/\/\/[^/@\s]+@/g,"//").replace(/(https?:\/\/[^\s?#]+)[?#][^\s)]*/g,"$1"),b?`${b}: ${c}`:c)}`),null}if(!g.ok)return i(f,`proxy returned HTTP ${g.status}`),null;let l=await g.json();return Array.isArray(l?.messages)?l:(i(f,"proxy response missing messages[]"),null)}async function l(a,{enabled:b,url:c,model:g,format:m,compressUserMessages:n,timeoutMs:o=3e3,diagnostics:p=null}={}){if(!b)return i(p,"disabled"),null;if(!c)return i(p,"missing proxy URL"),null;if(!a)return i(p,"missing request body"),null;try{if(p&&(p.before=h(a)),"claude"===m){let b=(0,d.t)(g,a,!1);if(!Array.isArray(b?.messages))return i(p,"Claude request did not translate to messages[]"),null;let f=await k(c,b.messages,g,o,n,p||{});if(!f)return null;let j=(0,e.p)(g,{...b,messages:f.messages},!1);return Array.isArray(j?.messages)&&(a.messages=j.messages),j?.system!==void 0&&(a.system=j.system),p&&(p.after=h(a)),f}if("openai-responses"===m){if(Array.isArray(a?.input)&&a.input.some(a=>!(!a||"object"!=typeof a||Array.isArray(a))&&"string"==typeof a.type&&"message"!==a.type))return i(p,"skipped: openai-responses tool/reasoning input is not safe to compress"),null;let b=(0,f.Z)(g,a,!1);if(!Array.isArray(b?.messages))return null;let d=await k(c,b.messages,g,o,n,p||{});if(!d)return null;let e=(0,f.h)(g,{...b,input:void 0,messages:d.messages},!1);return Array.isArray(e?.input)&&(a.input=e.input),p&&(p.after=h(a)),d}if("kiro"===m){let b=j(a);if(!b)return i(p,"Kiro request did not project to messages[]"),null;let d=await k(c,b.messages,g,o,n,p||{});if(!d||!function(a,b,c){if(!Array.isArray(b)||b.length!==a.messages.length)return i(c,"proxy response did not match Kiro message count"),!1;let d=[];for(let e=0;e<a.messages.length;e++){let f=a.messages[e],g=b[e];if(!g||g.role!==f.role)return i(c,"proxy response did not preserve Kiro message order"),!1;let h=function(a){let b=a?.content;if("string"==typeof b)return b;if(!Array.isArray(b))return null;let c=[];for(let a of b)"string"==typeof a?c.push(a):"string"==typeof a?.text&&c.push(a.text);return c.length>0?c.join("\n"):null}(g);if(null===h)return i(c,"proxy response missing Kiro text content"),!1;d.push({target:a.targets[e],text:h})}for(let a of d)a.target.object[a.target.key]=a.text;return!0}(b,d.messages,p))return null;return p&&(p.after=h(a)),d}let b=Array.isArray(a.messages)?"messages":Array.isArray(a.input)?"input":null;if(!b)return i(p,`unsupported ${m||"unknown"} request shape`),null;let l=await k(c,a[b],g,o,n,p||{});if(!l)return null;return a[b]=l.messages,p&&(p.after=h(a)),l}catch(a){return i(p,`unexpected error: ${a?.message||String(a)}`),null}}function m(a){if(!a)return null;let b=a.tokens_before||0,c=a.tokens_after||0,d=a.tokens_saved||0,e=b>0?(d/b*100).toFixed(1):"0";return`reported token delta=${d} before=${b}${c?` after=${c}`:""} (${e}%)`.trim()}function n(a){let b=a?.before,c=a?.after;return b&&c?`body=${b.bodyBytes}B→${c.bodyBytes}B messages=${b.messageBytes}B→${c.messageBytes}B`:""}function o(a,b,c=.05){if(!a?.tokens_saved||a.tokens_saved<=0)return!1;let d=b?.before?.bodyBytes||0,e=b?.after?.bodyBytes||0;return!(d<=0)&&!(e<=0)&&e>=d*(1-c)}},72152:(a,b,c)=>{c.d(b,{BI:()=>F,fT:()=>H});let d=new Set(["node_modules",".git","target","__pycache__",".next","dist","build",".cache",".turbo",".vercel",".pytest_cache",".mypy_cache",".tox",".venv","venv","env","coverage",".nyc_output",".DS_Store","Thumbs.db",".idea",".vscode",".vs","*.egg-info",".eggs"]);function e(a,b=500){let c=[],d="",f=0,g=0,h=!1,i=0,j=0,k=!1;for(let e of a.split("\n")){if(e.startsWith("diff --git")){j>0&&(c.push(` ... (${j} lines truncated)`),k=!0,j=0),d&&(f>0||g>0)&&c.push(` +${f} -${g}`);let a=e.split(" b/");d=a.length>1?a.slice(1).join(" b/"):"unknown",c.push(`
22
+ `,c=!0)}catch{continue}c||(b=a.startsWith("data:")&&!a.startsWith("data: ")?"data: "+a.slice(5)+"\n":a+"\n"),s?.appendConvertedChunk?.(b),f.enqueue(m.encode(b));continue}if(!p)continue;let r=(0,h.tV)(p,c);if(!r)continue;let t=c===e.h.OPENAI_RESPONSES,v=t&&q===e.h.OPENAI_RESPONSES,x=t?(0,i.yx)(P,r):null;if(t&&(0,i.nu)(x,r)&&(Q=!0),r&&r.done&&c!==e.h.OLLAMA){if(v&&!Q){let a=(0,i.u9)();s?.appendConvertedChunk?.(a),f.enqueue(m.encode(a)),Q=!0,K++}if(v&&!S){let a="data: [DONE]\n\n";s?.appendConvertedChunk?.(a),f.enqueue(m.encode(a))}S=!0,v&&(R=!0);continue}if(r.delta?.text&&(F+=r.delta.text.length,G+=r.delta.text),r.delta?.thinking&&(F+=r.delta.thinking.length,H+=r.delta.thinking),r.choices?.[0]?.delta?.content&&(F+=r.choices[0].delta.content.length,G+=r.choices[0].delta.content),M&&z&&r.choices?.[0]?.delta?.content){let a=r.choices[0].delta.content,{message:b,hasTools:c}=z({role:"assistant",content:a});c&&(N=b.tool_calls,r.choices[0].delta.content=b.content||void 0,r.choices[0].delta.content||delete r.choices[0].delta.content,F-=a.length,G=G.slice(0,G.length-a.length),b.content&&(F+=b.content.length,G+=b.content))}if(r.choices?.[0]?.delta?.reasoning_content&&(F+=r.choices[0].delta.reasoning_content.length,H+=r.choices[0].delta.reasoning_content),r.candidates?.[0]?.content?.parts)for(let a of r.candidates[0].content.parts)a.text&&"string"==typeof a.text&&(F+=a.text.length,!0===a.thought?H+=a.text:G+=a.text);let y=(0,g.f5)(r);if(y&&(E.usage=(0,g._L)(E.usage,y)),v&&x){let a=(0,h.v8)({event:x,data:r},q);s?.appendConvertedChunk?.(a),f.enqueue(m.encode(a)),P=null,K++;continue}P=null;let A=(0,d.Y8)(c,q,r,E);if(A?._openaiIntermediate)for(let a of A._openaiIntermediate){let b=(0,h.v8)(a,e.h.OPENAI);s?.appendOpenAIChunk?.(b)}if(A?.length>0)for(let a of A){if(null==a)continue;let b="message_delta"===a.type||a.choices?.[0]?.finish_reason;if(N&&b&&q===e.h.OPENAI){l(f,N,E,u,q,s)&&(K++,O=!0);continue}if(!(0,h.c2)(a,q))continue;if(E.finishReason&&b&&!(0,g.Gh)(a.usage)&&F>0){let b=(0,g.OF)(w,F,q);a.usage=(0,g.WL)(b,q),E.usage=b}else if(E.finishReason&&b&&E.usage){let b=(0,g.O9)(E.usage);a.usage=(0,g.WL)(b,q)}let c=(0,h.v8)(a,q);s?.appendConvertedChunk?.(c),f.enqueue(m.encode(c)),K++}}},flush(a){let k=Object.entries(L).map(([a,b])=>`${a}=${b}`).join(",")||"none";(0,j.s)("SSE",`flush | provider=${r} | model=${u} | recvLines=${J} | emitted=${K} | events=[${k}]`),(0,f.uw)(u,r,v,!1);try{let j=D.decode();if(j&&(A+=j),b===o){if(A){let b=A;A.startsWith("data:")&&!A.startsWith("data: ")&&(b="data: "+A.slice(5)),s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b))}!(0,g.Gh)(B)&&F>0&&(B=(0,g.OF)(w,F,e.h.OPENAI)),(0,g.Gh)(B)?(0,g.IF)(r,B,u,v,y):(0,f.E5)({model:u,provider:r,connectionId:v,tokens:null,status:"200 OK"}).catch(()=>{});let b="antigravity"===r||"gemini"===r||"vertex"===r;if(!S&&!b){let b="data: [DONE]\n\n";s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b))}x&&x({content:G,thinking:H},B,I);return}if(A.trim()){let b=(0,h.tV)(A.trim());if(b&&!b.done){let f=(0,d.Y8)(c,q,b,E);if(f?._openaiIntermediate)for(let a of f._openaiIntermediate){let b=(0,h.v8)(a,e.h.OPENAI);s?.appendOpenAIChunk?.(b)}if(f?.length>0)for(let b of f){if(null==b)continue;let c=(0,h.v8)(b,q);s?.appendConvertedChunk?.(c),a.enqueue(m.encode(c))}}}let k=(0,d.Y8)(c,q,null,E);if(k?._openaiIntermediate)for(let a of k._openaiIntermediate){let b=(0,h.v8)(a,e.h.OPENAI);s?.appendOpenAIChunk?.(b)}if(k?.length>0)for(let b of k){if(null==b)continue;let c=(0,h.v8)(b,q);s?.appendConvertedChunk?.(c),a.enqueue(m.encode(c))}if(!O&&M&&z){let{hasTools:b,message:c}=z({role:"assistant",content:G});b&&l(a,c.tool_calls,E,u,q,s)&&(K++,O=!0)}let n=c===e.h.OPENAI_RESPONSES&&q===e.h.OPENAI_RESPONSES;if(n&&!Q){let b=(0,i.u9)();s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b)),Q=!0}if(n&&!R&&!S){let b="data: [DONE]\n\n";s?.appendConvertedChunk?.(b),a.enqueue(m.encode(b)),R=!0,S=!0}!(0,g.Gh)(E?.usage)&&F>0&&(E.usage=(0,g.OF)(w,F,q)),(0,g.Gh)(E?.usage)?(0,g.IF)(E.provider||c,E.usage,u,v,y):(0,f.E5)({model:u,provider:r,connectionId:v,tokens:null,status:"200 OK"}).catch(()=>{}),x&&x({content:G,thinking:H},E?.usage,I)}catch(a){console.log("Error in flush:",a)}}})}function q(a,b,c=null,d=null,e=null,f=null,g=null,h=null,i=null,j=null,k=null){return p({mode:n,targetFormat:a,sourceFormat:b,provider:c,reqLogger:d,toolNameMap:e,model:f,connectionId:g,body:h,onStreamComplete:i,apiKey:j,normalizeKimiToolCalls:k})}function r(a=null,b=null,c=null,d=null,e=null,f=null,g=null,h=null){return p({mode:o,provider:a,reqLogger:b,model:c,connectionId:d,body:e,onStreamComplete:f,apiKey:g,normalizeKimiToolCalls:h})}},46646:(a,b,c)=>{c.d(b,{Hr:()=>j,nu:()=>h,u9:()=>k,yx:()=>g});var d=c(69152),e=c(30794);let f=new Set(["response.completed","response.done","response.failed","error"]);function g(a,b){return a||(b&&"string"==typeof b.type?b.type:null)}function h(a,b){let c=g(a,b);if(f.has(c))return!0;let d=b?.response?.status;return"completed"===d||"failed"===d}let i=new TextEncoder;function j(){return i.encode(`${k()}data: [DONE]
23
+
24
+ `)}function k(){return(0,e.v8)({event:"response.failed",data:{type:"response.failed",response:{id:`resp_${Date.now()}`,status:"failed",error:{type:"stream_error",code:"stream_disconnected",message:"stream closed before response.completed"}}}},d.h.OPENAI_RESPONSES)}},50996:(a,b,c)=>{function d(a,b){let c;if(!a.trim())return;let d=a.match(/^event:\s*(.+)$/m),e=a.match(/^data:\s*(.+)$/m);if(!d||!e)return;let f=d[1].trim(),g=e[1].trim();if("[DONE]"!==g){try{c=JSON.parse(g)}catch{return}"response.created"===f?(b.responseId=c.response?.id||b.responseId,b.created=c.response?.created_at||b.created):"response.output_item.done"===f?b.items.set(c.output_index??0,c.item):"response.completed"===f||"response.done"===f?(b.status="completed",c.response?.usage&&(b.usage.input_tokens=c.response.usage.input_tokens||0,b.usage.output_tokens=c.response.usage.output_tokens||0,b.usage.total_tokens=c.response.usage.total_tokens||0)):"response.failed"===f&&(b.status="failed")}}c.d(b,{I:()=>s,F:()=>r});let e={input_tokens:0,output_tokens:0,total_tokens:0};async function f(a){if(!a||"function"!=typeof a.getReader)return{id:`resp_${Date.now()}`,object:"response",created_at:Math.floor(Date.now()/1e3),status:"failed",output:[],usage:{...e}};let b=new TextDecoder,c="",f={responseId:"",created:Math.floor(Date.now()/1e3),status:"in_progress",usage:{...e},items:new Map};for await(let e of a){let a=(c+=b.decode(e,{stream:!0})).split("\n\n");for(let b of(c=a.pop()||"",a))d(b,f)}c.trim()&&d(c,f);let g=[],h=f.items.size>0?Math.max(...f.items.keys()):-1;for(let a=0;a<=h;a++)g.push(f.items.get(a)||{type:"message",content:[],role:"assistant"});return{id:f.responseId||`resp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,object:"response",created_at:f.created,status:f.status||"completed",output:g,usage:f.usage}}var g=c(15261),h=c(92398),i=c(69152),j=c(13946),k=c(92913),l=c(15204),m=c(14018),n=c(97781),o=c(23648);let p=a=>j.xq[a]?.format===i.h.OPENAI_RESPONSES;function q(a){if(!a?.content||!Array.isArray(a.content))return"";let b=a.content.find(a=>"output_text"===a.type);if("string"==typeof b?.text)return b.text;let c=a.content.find(a=>"string"==typeof a.text);return"string"==typeof c?.text?c.text:""}function r(a,b,c=null){let d=[],e=null;for(let b of String(a||"").split("\n")){let a=b.trim();if(!a.startsWith("data:"))continue;let c=a.slice(5).trim();if(c&&"[DONE]"!==c)try{let a=JSON.parse(c);a?.error?e=a.error:d.push(a)}catch{}}if(e)return{error:e};if(0===d.length)return null;let f=d[0],g=[],h=[],i=new Map,j="stop",k=null;for(let a of d){let b=a?.choices?.[0],c=b?.delta||{};if("string"==typeof c.content&&c.content.length>0&&g.push(c.content),"string"==typeof c.reasoning_content&&c.reasoning_content.length>0&&h.push(c.reasoning_content),b?.finish_reason&&(j=b.finish_reason),a?.usage&&"object"==typeof a.usage&&(k=a.usage),Array.isArray(c.tool_calls))for(let a of c.tool_calls){let b=a.index??0;i.has(b)||i.set(b,{id:a.id||"",type:"function",function:{name:"",arguments:""}});let c=i.get(b);a.id&&(c.id=a.id),a.function?.name&&(c.function.name+=a.function.name),a.function?.arguments&&(c.function.arguments+=a.function.arguments)}}let m={role:"assistant",content:g.join("")||(i.size>0?null:"")};if(h.length>0&&(m.reasoning_content=h.join("")),i.size>0){let a=[...i.entries()].sort((a,b)=>a[0]-b[0]).map(([,a])=>a);if(c&&c.length>0)for(let b of a)b.function?.name&&(b.function.name=(0,l.vh)(b.function.name,c));m.tool_calls=a}let n={id:f.id||`chatcmpl-${Date.now()}`,object:"chat.completion",created:f.created||Math.floor(Date.now()/1e3),model:f.model||b||"unknown",choices:[{index:0,message:m,finish_reason:j}]};return k&&(n.usage=k),n}async function s({providerResponse:a,sourceFormat:b,provider:c,model:d,body:e,stream:j,translatedBody:t,finalBody:u,requestStartTime:v,connectionId:w,apiKey:x,apiKeyName:y,clientRawRequest:z,onRequestSuccess:A,trackDone:B,appendLog:C,comboName:D,toolNameMap:E}){let F=a.headers.get("content-type")||"";if(!(F.includes("text/event-stream")||""===F&&p(c)))return null;B();let G={provider:c,model:d,connectionId:w,apiKey:x,apiKeyName:y,request:(0,k.Fo)(e,j),providerRequest:u||t||null};if(p(c)||b===i.h.OPENAI_RESPONSES)try{let e,g=await f(a.body);A&&await A();let h=g.usage||{};C({tokens:h,status:"200 OK"}),(0,k.qr)({provider:c,model:d,tokens:h,connectionId:w,apiKey:x,endpoint:z?.endpoint,comboName:D});let{msgItem:j,textContent:l}=function(a){if(!Array.isArray(a))return{msgItem:null,textContent:null};let b=a.filter(a=>a?.type==="message");if(0===b.length)return{msgItem:null,textContent:null};for(let a=b.length-1;a>=0;a--){let c=q(b[a]);if(c.length>0)return{msgItem:b[a],textContent:c}}let c=b[b.length-1];return{msgItem:c,textContent:q(c)}}(g.output),p=Date.now()-v;if((0,o.ox)((0,k.$R)({...G,latency:{ttft:p,total:p},tokens:{prompt_tokens:h.input_tokens||0,completion_tokens:h.output_tokens||0},response:{content:l,thinking:null,finish_reason:g.status||"unknown"},status:"success"},{endpoint:z?.endpoint||null})).catch(()=>{}),b===i.h.OPENAI_RESPONSES)return{success:!0,response:new Response(JSON.stringify(g),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})};let r=h.input_tokens||0,s=h.output_tokens||0,t=(g.output||[]).filter(a=>"function_call"===a.type).map((a,b)=>({id:a.call_id||`call_${a.name}_${Date.now()}_${b}`,type:"function",function:{name:a.name,arguments:"string"==typeof a.arguments?a.arguments:JSON.stringify(a.arguments||{})}})),u=t.length>0;if(b===i.h.ANTIGRAVITY||b===i.h.GEMINI||b===i.h.GEMINI_CLI)e={response:{candidates:[{content:{role:"model",parts:[{text:l||""}]},finishReason:"STOP",index:0}],usageMetadata:{promptTokenCount:r,candidatesTokenCount:s,totalTokenCount:r+s},modelVersion:d,responseId:g.id||`resp_${Date.now()}`}};else if(b===i.h.CLAUDE){let a={id:g.id||`chatcmpl-${Date.now()}`,model:g.model||d,choices:[{index:0,message:{role:"assistant",content:l||(u?null:"")},finish_reason:u?"tool_calls":"stop"}],usage:{prompt_tokens:r,completion_tokens:s}};u&&(a.choices[0].message.tool_calls=t);let b=(0,m.DT)(a,d);e=(0,n.kR)(b,E)}else{let a={role:"assistant",content:l||(u?null:"")};u&&(a.tool_calls=t);let b="completed"===g.status||"done"===g.status,c=u?"tool_calls":b?"stop":g.status||"stop";e={id:g.id||`chatcmpl-${Date.now()}`,object:"chat.completion",created:g.created_at||Math.floor(Date.now()/1e3),model:g.model||d,choices:[{index:0,message:a,finish_reason:c}],usage:{prompt_tokens:r,completion_tokens:s,total_tokens:r+s}}}return{success:!0,response:new Response(JSON.stringify(e),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}catch(a){return console.error("[ChatCore] Responses API SSE→JSON failed:",a),(0,g.A1)(h.gx.BAD_GATEWAY,"Failed to convert streaming response to JSON")}try{let f=await a.text(),j=r(f,d,(0,l.Qv)(e?.tools));if(!j)return(0,g.A1)(h.gx.BAD_GATEWAY,"Invalid SSE response for non-streaming request");if(j.error)return(0,g.A1)(h.gx.BAD_GATEWAY,j.error.message||"Upstream SSE stream failed");A&&await A();let p=j.usage||{};C({tokens:p,status:"200 OK"}),(0,k.qr)({provider:c,model:d,tokens:p,connectionId:w,apiKey:x,endpoint:z?.endpoint});let q=Date.now()-v;if((0,o.ox)((0,k.$R)({...G,latency:{ttft:q,total:q},tokens:p,response:{content:j.choices?.[0]?.message?.content||null,thinking:j.choices?.[0]?.message?.reasoning_content||null,finish_reason:j.choices?.[0]?.finish_reason||"unknown"},status:"success"},{endpoint:z?.endpoint||null})).catch(()=>{}),j?.choices)for(let a of j.choices)a?.message?.reasoning_content&&a.message.content&&delete a.message.reasoning_content;let s=j;if(b===i.h.CLAUDE){let a=(0,m.DT)(j,d);s=(0,n.kR)(a,E)}return{success:!0,response:new Response(JSON.stringify(s),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}catch(a){return console.error("[ChatCore] Chat Completions SSE→JSON failed:",a),(0,g.A1)(h.gx.BAD_GATEWAY,"Failed to convert streaming response to JSON")}}},56764:(a,b,c)=>{c.d(b,{U:()=>l});var d=c(5761);let e="You are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written. Before writing code, stop at the first rung that holds: 1. Does this need to exist at all? Speculative need = skip it, say so in one line (YAGNI). 2. Stdlib does it? Use it. 3. Native platform feature covers it? Use it (native input over a picker lib, CSS over JS, DB constraint over app code). 4. Already-installed dependency solves it? Use it. Never add a new dependency for what a few lines can do. 5. Can it be one line? One line. 6. Only then: the minimum code that works.",f="No unrequested abstractions (no interface with one implementation, no factory for one product, no config for a value that never changes). No boilerplate or scaffolding 'for later'. Deletion over addition. Boring over clever. Fewest files possible; shortest working diff wins. Two stdlib options the same size? Take the one correct on edge cases — lazy means less code, not the flimsier algorithm. Mark deliberate simplifications with a `ponytail:` comment naming the ceiling and upgrade path (e.g. `// ponytail: global lock, per-account locks if throughput matters`).",g="Never simplify away: input validation at trust boundaries, error handling that prevents data loss, security, accessibility, or anything explicitly requested. If the user insists on the full version, build it without re-arguing.",h="now is 2026, Be skeptical: never claim 'fixed', 'working', or 'correct' without concrete proof (test output, diff, reproducible verification). If a test passes, verify it tests what you think it tests. Check for side effects. Never fabricate reports ('all tests pass' without running them). Distinguish pre-existing bugs from ones you caused — run tests BEFORE and AFTER, diff the results. Report honestly: if broken and can't fix, say so. If skipped, explain why. If caveats, state them. Verify before declaring done — run relevant tests AFTER changes, show actual output.",i="Code first. Then at most three short lines: what was skipped and when to add it. Pattern: [code] then skipped: [X], add when [Y]. If the explanation is longer than the code, delete the explanation.",j="ACTIVE EVERY RESPONSE. No drift back to over-building. Still active if unsure.",k={lite:[e,"Level: lite. Build what's asked, but name the lazier alternative in one line — the user picks.",f,i,g,h,j].join(" "),full:[e,"Level: full. The ladder is enforced — stdlib and native first, shortest diff, shortest explanation. Ship the lazy version and question unrequested scope in the same response.",f,i,g,h,j].join(" "),ultra:[e,"Level: ultra. YAGNI extremist. Deletion before addition. Ship the one-liner and challenge the rest of the requirement in the same breath. No feature until a profiler or a real requirement demands it.",f,i,g,h,j].join(" ")};function l(a,b,c){(0,d.J)(a,b,k[c])}},60137:(a,b,c)=>{c.d(b,{$:()=>r,M:()=>q});var d=c(69152),e=c(56974),f=c(45479),g=c(77380),h=c(78963),i=c(13946),j=c(92398),k=c(46646),l=c(92913),m=c(23648),n=c(2933);async function o(a){if(!a||"function"!=typeof a.getReader)return{empty:!0};let b=a.getReader();try{let{done:a,value:c}=await b.read();if(a)return{empty:!0};return{empty:!1,firstChunk:c,reader:b}}catch(a){throw b.cancel?.().catch(()=>{}),a}}let p={[d.h.OPENAI_RESPONSES]:d.h.OPENAI_RESPONSES,[d.h.CLAUDE]:d.h.CLAUDE,[d.h.ANTIGRAVITY]:d.h.ANTIGRAVITY,[d.h.GEMINI]:d.h.ANTIGRAVITY,[d.h.GEMINI_CLI]:d.h.ANTIGRAVITY};async function q({providerResponse:a,provider:b,model:c,sourceFormat:r,targetFormat:s,userAgent:t,body:u,stream:v,translatedBody:w,finalBody:x,requestStartTime:y,connectionId:z,apiKey:A,apiKeyName:B,clientRawRequest:C,onRequestSuccess:D,reqLogger:E,toolNameMap:F,streamController:G,onStreamComplete:H,streamDetailId:I,pxpipe:J}){let K;D&&Promise.resolve().then(D).catch(a=>{console.error("[ChatCore] onRequestSuccess failed:",a?.message||a)});let L=(a.headers.get("content-type")||"").toLowerCase();!L||L.includes("text/event-stream")||L.includes("application/json")||console.warn("[STREAM] "+b+" | "+c+" | unexpected Content-Type: "+L);try{K=await o(a.body)}catch(a){return{success:!1,status:502,errorCode:"STREAM_EARLY_EOF",error:a?.message||String(a)}}if(K.empty)return{success:!1,status:502,errorCode:"STREAM_EARLY_EOF",error:"Upstream closed stream before any useful content"};let M=function({provider:a,sourceFormat:b,targetFormat:c,userAgent:h,reqLogger:j,toolNameMap:k,model:l,connectionId:m,body:n,onStreamComplete:o,apiKey:q}){let r=h?.toLowerCase().includes("droid")||h?.toLowerCase().includes("codex-cli"),s=i.xq[a]?.format===d.h.OPENAI_RESPONSES&&c===d.h.OPENAI_RESPONSES&&!r,t=/kimi-k2\./i.test(l||"");if(s){let c=p[b]||d.h.OPENAI;return(0,f.i5)(d.h.OPENAI_RESPONSES,c,a,j,k,l,m,n,o,q,t?g.vH:null)}return(0,e.nZ)(c,b)?(0,f.i5)(c,b,a,j,k,l,m,n,o,q,t?g.vH:null):(0,f.l2)(a,j,l,m,n,o,q,t?g.vH:null)}({provider:b,sourceFormat:r,targetFormat:s,userAgent:t,reqLogger:E,toolNameMap:F,model:c,connectionId:z,body:u,onStreamComplete:H,apiKey:A}),N=r===d.h.OPENAI_RESPONSES&&s===d.h.OPENAI_RESPONSES?k.Hr:null,O=i.xq[b]?.stallTimeoutMs||j.xM,P=new Response(function({firstChunk:a,reader:b}){let c=!1;return new ReadableStream({async pull(d){if(!c){d.enqueue(a),c=!0;return}try{let{done:a,value:c}=await b.read();a?(d.close(),b.releaseLock?.()):d.enqueue(c)}catch(a){d.error(a),b.cancel?.().catch(()=>{})}},cancel(a){b.cancel?.(a).catch(()=>{})}})}(K),{status:a.status,statusText:a.statusText,headers:a.headers}),Q=(0,h.Jb)(P,M,G,N,O);return(0,m.ox)((0,l.$R)({provider:b,model:c,connectionId:z,apiKey:A,apiKeyName:B,latency:{ttft:0,total:Date.now()-y},tokens:{prompt_tokens:0,completion_tokens:0},request:(0,l.Fo)(u,v),providerRequest:x||w||null,providerResponse:"[Streaming - raw response not captured]",response:{content:"[Streaming in progress...]",thinking:null,type:"streaming"},pxpipe:J,status:"success"},{id:I})).catch(a=>{console.error("[RequestDetail] Failed to save streaming request:",a.message)}),{success:!0,response:new Response(Q,{headers:n.RK})}}function r({provider:a,model:b,connectionId:c,apiKey:d,apiKeyName:e,requestStartTime:f,body:g,stream:h,finalBody:i,translatedBody:j,clientRawRequest:k,pxpipe:n}){let o=`${Date.now()}-${Math.random().toString(36).slice(2,11)}`;return{onStreamComplete:(p,q,r)=>{let s={ttft:r?r-f:Date.now()-f,total:Date.now()-f},t=p?.content||"[Empty streaming response]",u=p?.thinking||null;(0,m.ox)((0,l.$R)({provider:a,model:b,connectionId:c,apiKey:d,apiKeyName:e,latency:s,tokens:q||{prompt_tokens:0,completion_tokens:0},request:(0,l.Fo)(g,h),providerRequest:i||j||null,providerResponse:t,response:{content:t,thinking:u,type:"streaming"},pxpipe:n,status:"success"},{id:o})).catch(a=>{console.error("[RequestDetail] Failed to update streaming content:",a.message)}),(0,l.qr)({provider:a,model:b,tokens:q,connectionId:c,apiKey:d,endpoint:k?.endpoint,label:"STREAM USAGE"})},streamDetailId:o}}},61210:(a,b,c)=>{c.d(b,{F:()=>g});let d=[{triggers:["mcp__exa__web_search_exa","mcp__exa__web_fetch_exa"],strip:["WebSearch","WebFetch","mcp__workspace__web_fetch"]},{triggers:["mcp__tavily__tavily_search","mcp__tavily__tavily_extract"],strip:["WebSearch","WebFetch","mcp__workspace__web_fetch"]},{triggers:[/^mcp__browsermcp__/],strip:[/^mcp__Claude_in_Chrome__/]}];function e(a){return a?.name||a?.function?.name||""}function f(a,b){return"string"==typeof b?a===b:b instanceof RegExp&&b.test(a)}function g(a){if(!Array.isArray(a)||0===a.length)return{tools:a,stripped:[]};let b=a.map(e),c=new Set;for(let a of d)if(b.some(b=>a.triggers.some(a=>f(b,a))))for(let d of b)a.strip.some(a=>f(d,a))&&c.add(d);return 0===c.size?{tools:a,stripped:[]}:{tools:a.filter(a=>!c.has(e(a))),stripped:Array.from(c)}}},63192:(a,b,c)=>{c.d(b,{p:()=>n});var d=c(5761);let e="Code blocks, file paths, commands, errors, URLs: keep exact. Security warnings, irreversible action confirmations, multi-step ordered sequences: write normal. Resume terse style after.",f='Not: "Sure! I\'d be happy to help you with that. The issue you\'re experiencing is likely caused by..." Yes: "Bug in auth middleware. Token expiry check use `<` not `<=`. Fix:"',g="Auto-Clarity: drop caveman for security warnings, irreversible actions, multi-step sequences where fragment ambiguity risks misread, or when user repeats a question. Resume after the clear part.",h="ACTIVE EVERY RESPONSE. No revert after many turns. No filler drift. Still active if unsure.",i="No invented abbreviations. Standard well-known tech acronyms (DB, API, HTTP, URL, JSON, ID, OS, CPU) OK. Names of code symbols, function names, API names, error strings: keep verbatim.",j="Preserve the user's dominant language. User wrote Vietnamese, reply Vietnamese. User wrote English, reply English. Wenyan/classical-Chinese levels override this language-preservation rule. Code identifiers, error strings, file paths, commands: keep in their original form regardless of language.",k='No self-reference. Do not name or announce the style (no "caveman mode", no "me caveman think", no "compressed mode active"). Just respond.',l='No decorative emoji. No narrating tool calls ("I will now search", "I used X to find Y"). No status phrases ("Sure!", "Of course!", "I\'d be happy to"). No causal arrow shorthand ("A -> B -> fails"). State the thing, the action, the reason. Then next step.',m={lite:["Respond tersely. Keep grammar and full sentences but drop filler, hedging and pleasantries (just/really/basically/sure/of course/I'd be happy to). Pattern: state the thing, the action, the reason. Then next step.",f,e,g,h,i,j,k,l].join(" "),full:["Respond like terse caveman. All technical substance stay exact, only fluff die. Drop: articles (a/an/the), filler (just/really/basically/actually/simply), pleasantries, hedging. Fragments OK. Short synonyms (big not extensive, fix not implement a solution for). Pattern: [thing] [action] [reason]. [next step].",f,e,g,h,i,j,k,l].join(" "),ultra:["Respond ultra-terse. Maximum compression. Telegraphic. Strip conjunctions. One word when one word enough. Pattern: [thing] [action] [reason]. [next step].",f,e,g,h,i,j,k,l].join(" "),"wenyan-lite":["Respond semi-classical. Drop filler/hedging but keep grammar structure, classical register. Use classical Chinese sentence patterns where natural. Keep English for technical terms.",f,e,g,h,i,j,k,l].join(" "),wenyan:["Respond classical Chinese (æ–‡č¨€æ–‡). Maximum classical terseness. 80-90% character reduction. Classical sentence patterns, verbs precede objects, subjects often omitted, classical particles (之/䚃/į‚ē/å…ļ). Keep English for code, commands, function names, API names, error strings.",f,e,g,h,i,j,k,l].join(" "),"wenyan-ultra":["Respond extreme classical compression (æ–‡č¨€æ–‡ ultra). Maximum compression, ultra terse. Same classical rules as wenyan-full but even more compressed. One classical particle per clause.",f,e,g,h,i,j,k,l].join(" ")};function n(a,b,c){(0,d.J)(a,b,m[c])}},69188:(a,b,c)=>{c.d(b,{Nv:()=>m,O2:()=>n,SI:()=>l,cB:()=>o});var d=c(48117),e=c(40657),f=c(59463);function g(a){try{return new TextEncoder().encode(JSON.stringify(a)||"").length}catch{return 0}}function h(a){let b=function(a){if(Array.isArray(a?.messages))return a.messages;if(Array.isArray(a?.input))return a.input;let b=j(a);return b?b.messages:null}(a);return{bodyBytes:g(a),messageBytes:b?g(b):0}}function i(a,b){a&&!a.reason&&(a.reason=b)}function j(a){let b=a?.conversationState;if(!b||"object"!=typeof b)return null;let c=[],d=[],e=(a,b,e,f={})=>{"string"==typeof b&&(c.push({role:a,content:b,...f}),d.push(e))},f=a=>{let b=a?.userInputMessage;if(b){e("system",b.systemInstruction,{object:b,key:"systemInstruction"}),e("user",b.content,{object:b,key:"content"});let a=b.userInputMessageContext?.toolResults;if(Array.isArray(a))for(let b of a){let a=b?.content;if(Array.isArray(a))for(let c of a)e("tool",c?.text,{object:c,key:"text"},b?.toolUseId?{tool_call_id:b.toolUseId}:{})}return}let c=a?.assistantResponseMessage;if(c){let a=(a=>{if(!Array.isArray(a)||0===a.length)return;let b=a.map(a=>({id:a?.toolUseId,type:"function",function:{name:a?.name||"",arguments:JSON.stringify(a?.input||{})}})).filter(a=>a.id||a.function.name);return b.length>0?b:void 0})(c.toolUses);e("assistant",c.content,{object:c,key:"content"},a?{tool_calls:a}:{})}};if(Array.isArray(b.history))for(let a of b.history)f(a);return b.currentMessage&&f(b.currentMessage),c.length>0?{messages:c,targets:d}:null}async function k(a,b,c,d,e,f){let g,h=function(a){try{let b=new URL(a);return b.pathname=`${b.pathname.replace(/\/$/,"")}/v1/compress`,b.hash="",b.toString()}catch{let[b,c=""]=String(a).replace(/#.*$/,"").split("?",2),d=`${b.replace(/\/$/,"")}/v1/compress`;return c?`${d}?${c}`:d}}(a);f.endpoint=function(a){try{let b=new URL(a);return b.username="",b.password="",b.search="",b.hash="",b.toString()}catch{return String(a).replace(/\/\/[^/@\s]+@/,"//").replace(/[?#].*$/,"")}}(h);let j={messages:b,model:c};e&&(j.config={compress_user_messages:!0});try{g=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j),signal:AbortSignal.timeout(d)})}catch(d){var k;let a,b,c;return i(f,`request failed: ${(k=d,a=k?.cause,b=a?.code||k?.code,c=String(a?.message||k?.message||String(k)).replace(/\/\/[^/@\s]+@/g,"//").replace(/(https?:\/\/[^\s?#]+)[?#][^\s)]*/g,"$1"),b?`${b}: ${c}`:c)}`),null}if(!g.ok)return i(f,`proxy returned HTTP ${g.status}`),null;let l=await g.json();return Array.isArray(l?.messages)?l:(i(f,"proxy response missing messages[]"),null)}async function l(a,{enabled:b,url:c,model:g,format:m,compressUserMessages:n,timeoutMs:o=3e3,diagnostics:p=null}={}){if(!b)return i(p,"disabled"),null;if(!c)return i(p,"missing proxy URL"),null;if(!a)return i(p,"missing request body"),null;try{if(p&&(p.before=h(a)),"claude"===m){let b=(0,d.t)(g,a,!1);if(!Array.isArray(b?.messages))return i(p,"Claude request did not translate to messages[]"),null;let f=await k(c,b.messages,g,o,n,p||{});if(!f)return null;let j=(0,e.p)(g,{...b,messages:f.messages},!1);return Array.isArray(j?.messages)&&(a.messages=j.messages),j?.system!==void 0&&(a.system=j.system),p&&(p.after=h(a)),f}if("openai-responses"===m){if(Array.isArray(a?.input)&&a.input.some(a=>!(!a||"object"!=typeof a||Array.isArray(a))&&"string"==typeof a.type&&"message"!==a.type))return i(p,"skipped: openai-responses tool/reasoning input is not safe to compress"),null;let b=(0,f.Z)(g,a,!1);if(!Array.isArray(b?.messages))return null;let d=await k(c,b.messages,g,o,n,p||{});if(!d)return null;let e=(0,f.h)(g,{...b,input:void 0,messages:d.messages},!1);return Array.isArray(e?.input)&&(a.input=e.input),p&&(p.after=h(a)),d}if("kiro"===m){let b=j(a);if(!b)return i(p,"Kiro request did not project to messages[]"),null;let d=await k(c,b.messages,g,o,n,p||{});if(!d||!function(a,b,c){if(!Array.isArray(b)||b.length!==a.messages.length)return i(c,"proxy response did not match Kiro message count"),!1;let d=[];for(let e=0;e<a.messages.length;e++){let f=a.messages[e],g=b[e];if(!g||g.role!==f.role)return i(c,"proxy response did not preserve Kiro message order"),!1;let h=function(a){let b=a?.content;if("string"==typeof b)return b;if(!Array.isArray(b))return null;let c=[];for(let a of b)"string"==typeof a?c.push(a):"string"==typeof a?.text&&c.push(a.text);return c.length>0?c.join("\n"):null}(g);if(null===h)return i(c,"proxy response missing Kiro text content"),!1;d.push({target:a.targets[e],text:h})}for(let a of d)a.target.object[a.target.key]=a.text;return!0}(b,d.messages,p))return null;return p&&(p.after=h(a)),d}let b=Array.isArray(a.messages)?"messages":Array.isArray(a.input)?"input":null;if(!b)return i(p,`unsupported ${m||"unknown"} request shape`),null;let l=await k(c,a[b],g,o,n,p||{});if(!l)return null;return a[b]=l.messages,p&&(p.after=h(a)),l}catch(a){return i(p,`unexpected error: ${a?.message||String(a)}`),null}}function m(a){if(!a)return null;let b=a.tokens_before||0,c=a.tokens_after||0,d=a.tokens_saved||0,e=b>0?(d/b*100).toFixed(1):"0";return`reported token delta=${d} before=${b}${c?` after=${c}`:""} (${e}%)`.trim()}function n(a){let b=a?.before,c=a?.after;return b&&c?`body=${b.bodyBytes}B→${c.bodyBytes}B messages=${b.messageBytes}B→${c.messageBytes}B`:""}function o(a,b,c=.05){if(!a?.tokens_saved||a.tokens_saved<=0)return!1;let d=b?.before?.bodyBytes||0,e=b?.after?.bodyBytes||0;return!(d<=0)&&!(e<=0)&&e>=d*(1-c)}},72152:(a,b,c)=>{c.d(b,{BI:()=>F,fT:()=>H});let d=new Set(["node_modules",".git","target","__pycache__",".next","dist","build",".cache",".turbo",".vercel",".pytest_cache",".mypy_cache",".tox",".venv","venv","env","coverage",".nyc_output",".DS_Store","Thumbs.db",".idea",".vscode",".vs","*.egg-info",".eggs"]);function e(a,b=500){let c=[],d="",f=0,g=0,h=!1,i=0,j=0,k=!1;for(let e of a.split("\n")){if(e.startsWith("diff --git")){j>0&&(c.push(` ... (${j} lines truncated)`),k=!0,j=0),d&&(f>0||g>0)&&c.push(` +${f} -${g}`);let a=e.split(" b/");d=a.length>1?a.slice(1).join(" b/"):"unknown",c.push(`
25
25
  ${d}`),f=0,g=0,h=!1,i=0}else e.startsWith("@@")?(j>0&&(c.push(` ... (${j} lines truncated)`),k=!0,j=0),h=!0,i=0,c.push(` ${e}`)):h&&(e.startsWith("+")&&!e.startsWith("+++")?(f+=1,i<100?(c.push(` ${e}`),i+=1):j+=1):e.startsWith("-")&&!e.startsWith("---")?(g+=1,i<100?(c.push(` ${e}`),i+=1):j+=1):i<100&&!e.startsWith("\\")&&i>0&&(c.push(` ${e}`),i+=1));if(c.length>=b){c.push("\n... (more changes truncated)"),k=!0;break}}return j>0&&(c.push(` ... (${j} lines truncated)`),k=!0),d&&(f>0||g>0)&&c.push(` +${f} -${g}`),k&&c.push("[full diff: rtk git diff --no-compact]"),c.join("\n")}function f(a){let b=a.split("\n");if(0===b.length||1===b.length&&!b[0].trim())return"Clean working tree";let c="",d=[],e=[],f=[],g=0,h=0,i=0,j=0;for(let a of b){if(!a.trim())continue;let b=a.match(/^On branch (\S+)/);if(b){c=b[1];continue}if(a.startsWith("##")){c=a.replace(/^##\s*/,"");continue}if(a.length>=3&&/^[ MADRCU?!][ MADRCU?!] /.test(a)){let b=a[0],c=a[1],k=a.slice(3);if("??"===a.slice(0,2)){i++,f.push(k);continue}"MADRC".includes(b)?(g++,d.push(k)):"U"===b&&j++,("M"===c||"D"===c)&&(h++,e.push(k));continue}let k=a.match(/^\s*(modified|new file|deleted|renamed|both modified):\s+(.+)$/);if(k){let a=k[1],b=k[2].trim();"both modified"===a?j++:"modified"===a||"deleted"===a?(h++,e.push(b)):("new file"===a||"renamed"===a)&&(g++,d.push(b));continue}}let k="";if(c&&(k+=`* ${c}
26
26
  `),g>0){for(let a of(k+=`+ Staged: ${g} files
27
27
  `,d.slice(0,10)))k+=` ${a}
@@ -65,10 +65,10 @@ ${e.length} files in ${g.length} dirs:
65
65
  `,b.slice(0,10)))h+=` ${c}
66
66
  `;b.length>10&&(h+=` +${b.length-10}
67
67
  `),h+="\n"}return g.length>20&&(h+=`+${g.length-20} more dirs
68
- `),h.replace(/\n+$/,"")}s.filterName="search-list";let t=/^Result of search in '[^']*' \(total (\d+) files?\):/,u=/^diff --git /m,v=/^@@ /m,w=/^On branch |^nothing to commit|^Changes (not |to be )|^Untracked files:/m,x=/^[*|/\\ ]*commit [0-9a-f]{7,40}$/m,y=/^[ MADRCU?!][ MADRCU?!] \S/m,z=/^(npm (warn|error|ERR!)|yarn (warn|error)|\s*Compiling\s+\S+|\s*Downloading\s+\S+|added \d+ package|\[ERROR\]|BUILD (SUCCESS|FAILED)|\s*Finished\s+|Successfully (installed|built)|ERROR:)/im,A=/[├└]──|│ /,B=/^[-dlbcps][rwx-]{9}/m,C=/^total \d+$/m;function D(a){let b=a.indexOf(":");if(-1===b)return!1;let c=a.indexOf(":",b+1);if(-1===c)return!1;let d=a.slice(b+1,c);return/^\d+$/.test(d)}function E(a){let b=a.trim();return 0!==b.length&&(!!/^[A-Za-z]:[\\/]/.test(b)||!b.includes(":")&&(b.startsWith(".")||b.startsWith("/")||b.includes("/")))}function F(a,b){if(void 0===b&&(b=!1),!b||!a)return null;if(a.conversationState){var c=a;let b={bytesBefore:0,bytesAfter:0,hits:[]};try{let a=c.conversationState,d=[...Array.isArray(a?.history)?a.history:[]];for(let c of(a?.currentMessage&&d.push(a.currentMessage),d)){let a=c?.userInputMessage?.userInputMessageContext?.toolResults;if(Array.isArray(a)){for(let c of a)if("error"!==c.status&&Array.isArray(c.content))for(let a of c.content)a&&"string"==typeof a.text&&(a.text=G(a.text,b,"kiro-tool-result"))}}}catch(a){return console.warn("[RTK] compressKiroFormat error:",a.message),null}return b}let d=Array.isArray(a.messages)?a.messages:Array.isArray(a.input)?a.input:null;if(!d)return null;let e={bytesBefore:0,bytesAfter:0,hits:[]};try{for(let a=0;a<d.length;a++){let b=d[a];if(b){if("function_call_output"===b.type){if("string"==typeof b.output)b.output=G(b.output,e,"openai-responses-string");else if(Array.isArray(b.output))for(let a=0;a<b.output.length;a++){let c=b.output[a];c&&"input_text"===c.type&&"string"==typeof c.text&&(c.text=G(c.text,e,"openai-responses-array"))}continue}if("tool"===b.role&&"string"==typeof b.content){b.content=G(b.content,e,"openai-tool");continue}if(Array.isArray(b.content)){if("tool"===b.role){for(let a=0;a<b.content.length;a++){let c=b.content[a];c&&"text"===c.type&&"string"==typeof c.text&&(c.text=G(c.text,e,"openai-tool-array"))}continue}for(let a=0;a<b.content.length;a++){let c=b.content[a];if(c&&"tool_result"===c.type&&!0!==c.is_error){if("string"==typeof c.content)c.content=G(c.content,e,"claude-string");else if(Array.isArray(c.content))for(let a=0;a<c.content.length;a++){let b=c.content[a];b&&"text"===b.type&&"string"==typeof b.text&&(b.text=G(b.text,e,"claude-array"))}}}}}}}catch(a){return console.warn("[RTK] compressMessages error:",a.message),null}return e}function G(a,b,c){let d=a.length;if(b.bytesBefore+=d,d<500||d>0xa00000)return b.bytesAfter+=d,a;let h=function(a){var b,c;let d,h,m=a.length>1024?a.slice(0,1024):a;if(x.test(m))return g;if(u.test(m)||v.test(m))return e;if(w.test(m))return f;if(z.test(m))return i;if(!((d=m.split("\n").filter(a=>a.trim())).length<3)&&d.filter(a=>y.test(a)).length/d.length>=.6)return f;let F=m.split("\n"),G=F.filter(a=>a.trim().length>0);return G.slice(0,5).some(D)?j:G.length>=3&&G.every(E)?k:A.test(m)?o:C.test(m)||(b=m,h=new RegExp((c=B).source,c.flags.includes("g")?c.flags:c.flags+"g"),(b.match(h)||[]).length>=3)?n:t.test(m)?s:F.length>=250&&function(a){let b=0,c=0;for(let d of a.slice(0,100))0!==d.length&&(c++,r.test(d)&&b++);return!(c<5)&&b/c>=.7}(F)?q:G.length>=5?l:a.split("\n").length>=250?p:null}(a);if(!h)return b.bytesAfter+=d,a;let m=function(a,b){if("function"!=typeof a)return b;try{let c=a(b);if("string"!=typeof c)return b;return c}catch(d){let c=a.filterName||a.name||"anonymous";return console.warn(`[rtk] warning: filter '${c}' panicked — passing through raw output: ${d?.message||d}`),b}}(h,a);return!m||0===m.length||m.length>=d?(b.bytesAfter+=d,a):(b.bytesAfter+=m.length,b.hits.push({shape:c,filter:h.filterName||h.name,saved:d-m.length}),m)}function H(a){if(!a||!a.hits||0===a.hits.length)return null;let b=a.bytesBefore-a.bytesAfter,c=a.bytesBefore>0?(b/a.bytesBefore*100).toFixed(1):"0",d=Array.from(new Set(a.hits.map(a=>a.filter))).join(",");return`[RTK] saved ${b}B / ${a.bytesBefore}B (${c}%) via [${d}] hits=${a.hits.length}`}},77380:(a,b,c)=>{c.d(b,{vH:()=>f});let d="functions.";function e(a){let b=a.indexOf(d);return -1===b?{prefix:a,tail:""}:{prefix:a.slice(0,b).trim(),tail:a.slice(b)}}function f(a){let b=a?.content,c="string"==typeof b?b:"";if(Array.isArray(a?.tool_calls)&&a.tool_calls.length>0)return{message:{...a},hasTools:!0,originalContent:c};let f=function(a){if(!("string"==typeof a&&0!==a.length&&a.includes(d)))return[];let{tail:b}=e(a);if(!b)return[];let c=[],f=b,g=0;for(;f.length>0&&c.length<64&&f.startsWith(d);){let a=(f=f.slice(d.length)).indexOf(d),b=function(a,b){let c;if("string"!=typeof a||0===a.length)return null;let d=a.indexOf("{");if(-1===d)return null;let e=a.slice(0,d).trim(),f=a.slice(d),g=e.match(/^([a-zA-Z0-9_\-/.]+)(?::([a-zA-Z0-9_\-]+))?$/);if(!g)return null;let h=g[1],i=g[2];try{c=function(a){let b=0,c=!1,d=!1,e=-1;for(let f=0;f<a.length;f++){let g=a[f];if(c){if(d){d=!1;continue}if("\\"===g){d=!0;continue}'"'===g&&(c=!1);continue}if('"'===g){c=!0;continue}if("{"===g){1==++b&&(e=-1);continue}if("}"===g){if(0==--b){e=f+1;break}continue}}if(-1===e)throw Error("unbalanced JSON object");return JSON.parse(a.slice(0,e))}(f)}catch{return null}return{id:i?`functions.${h}:${i}`:`functions.${h}:${b}`,type:"function",function:{name:h,arguments:JSON.stringify(c)}}}(-1===a?f:f.slice(0,a),g);if(!b||(c.push(b),g++,-1===a))break;f=f.slice(a)}return c}(c);if(0===f.length)return{message:{...a},hasTools:!1,originalContent:c};let{prefix:g}=e(c);return{message:{...a,content:g,tool_calls:f},hasTools:!0,originalContent:c}}},78963:(a,b,c)=>{c.d(b,{Jb:()=>g,jd:()=>f});var d=c(92398),e=c(25440);function f({onDisconnect:a,onError:b,log:c,provider:d,model:g}={}){let h=new AbortController,i=Date.now(),j=!1,k=null,l=a=>{let b=Date.now()-i,c=d?.toUpperCase()||"UNKNOWN";console.log(`[${new Date().toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}] 🌊 [STREAM] ${c} | ${g||"unknown"} | ${b}ms | ${a}`)};return{signal:h.signal,startTime:i,isConnected:()=>!j,handleDisconnect:(b="client_closed")=>{j||(j=!0,l(`disconnect: ${b}`),(0,e.s)("CTRL",`${d}/${g} | disconnect=${b} | dur=${Date.now()-i}ms`),k=setTimeout(()=>{h.abort()},500),a?.({reason:b,duration:Date.now()-i}))},handleComplete:()=>{!j&&(j=!0,l("complete"),k&&(clearTimeout(k),k=null))},handleError:a=>{if(!j){if(j=!0,k&&(clearTimeout(k),k=null),"AbortError"===a.name)return void l("aborted");l(`error: ${a.message}`),b?.(a)}},abort:()=>h.abort()}}function g(a,b,c,f=null,h=d.xM){let i=null,j=0,k=0,l=Date.now(),m=Date.now(),n="STREAM",o=()=>{i&&(clearTimeout(i),i=null)},p=()=>{o(),i=setTimeout(()=>{i=null,(0,e.s)(n,`STALL TIMEOUT ${h}ms | chunks=${j} | bytes=${k} | sinceLast=${Date.now()-l}ms`),c.handleError?.(Error("stream stall timeout")),c.abort?.()},h)},q={signal:c.signal,startTime:c.startTime,isConnected:()=>c.isConnected(),handleComplete:()=>{(0,e.s)(n,`complete | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o(),c.handleComplete()},handleError:a=>{(0,e.s)(n,`error: ${a?.message} | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o(),c.handleError(a)},handleDisconnect:a=>{(0,e.s)(n,`disconnect: ${a} | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o(),c.handleDisconnect(a)},abort:()=>{o(),c.abort()}};p(),(0,e.s)(n,`pipe start | stallTimeout=${h}ms`);let r=new TransformStream({transform(a,b){j++;let c=a?.byteLength||a?.length||0;k+=c;let d=Date.now(),f=d-l;l=d,e.T&&(j<=5||j%20==0||f>5e3)&&(0,e.s)(n,`chunk #${j} | size=${c}B | gap=${f}ms | total=${k}B`),p(),b.enqueue(a)},flush(){(0,e.s)(n,`upstream EOF | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o()}});return function(a,b,c=null){let d=a.readable.getReader(),e=a.writable.getWriter(),f=!1,g=a=>{if(!f&&c){f=!0;try{let b=c();b&&a.enqueue(b)}catch{}}};return new ReadableStream({async pull(a){if(!b.isConnected()){g(a),a.close();return}try{let{done:c,value:e}=await d.read();if(c){b.handleComplete(),a.close();return}a.enqueue(e)}catch(l){let f=b.isConnected(),h=l?.message||"";h.includes("already closed")||h.includes("Invalid state")||b.handleError(l),d.cancel().catch(()=>{}),e.abort().catch(()=>{});let i=l?.message||"",j=l?.code||l?.cause?.code||"",k="AbortError"===l.name||i.includes("aborted")||i.includes("socket hang up")||i.includes("ECONNRESET")||i.includes("ETIMEDOUT")||i.includes("EPIPE")||"ECONNRESET"===j||"ETIMEDOUT"===j||"EPIPE"===j||"UND_ERR_SOCKET"===j;try{!f||k||c?(g(a),a.close()):a.error(l)}catch(a){}}},cancel(a){b.handleDisconnect(a||"cancelled"),d.cancel(),e.abort()}})}({readable:a.body.pipeThrough(r).pipeThrough(b),writable:{getWriter:()=>({abort:()=>Promise.resolve()})}},q,f)}},80117:(a,b,c)=>{c.d(b,{C:()=>h});var d=c(69152),e=c(99067);let f=new Set([d.h.GEMINI,d.h.GEMINI_CLI,d.h.VERTEX,d.h.ANTIGRAVITY,d.h.OLLAMA,d.h.KIRO]);function g(a){return"string"==typeof a&&(a.startsWith("http://")||a.startsWith("https://"))}async function h(a,b,c,i={}){if(!a||!f.has(c))return 0;let j=function(a,b){let c=[],e=a=>{for(let b of a||[])if(Array.isArray(b.content)){for(let a of b.content)if(a?.type==="image_url"){let b="string"==typeof a.image_url?a.image_url:a.image_url?.url;g(b)&&c.push({get:()=>b,set:b=>{"string"==typeof a.image_url?a.image_url=b:a.image_url.url=b}})}}},f=a=>{for(let b of a||[])for(let a of b.parts||[]){let b=a?.fileData?.fileUri;g(b)&&c.push({get:()=>b,part:a})}};switch(b){case d.h.OPENAI:case d.h.OLLAMA:case d.h.KIRO:case d.h.CURSOR:case d.h.COMMANDCODE:e(a.messages);break;case d.h.CLAUDE:for(let b of a.messages||[])if(Array.isArray(b.content))for(let a of b.content)a?.type==="image"&&a.source?.type==="url"&&g(a.source.url)&&c.push({get:()=>a.source.url,claudeBlock:a});break;case d.h.GEMINI:case d.h.GEMINI_CLI:case d.h.VERTEX:f(a.contents);break;case d.h.ANTIGRAVITY:f(a?.request?.contents);break;default:e(a.messages)}return c}(a,b);if(!j.length)return 0;let k=0;for(let a of j){let b=a.get();if((0,e.W$)(b))continue;let c=await (0,e.ni)(b,i);c&&(a.set?a.set(c.url):a.part?(delete a.part.fileData,a.part.inlineData={mimeType:c.mimeType,data:c.url.split(",")[1]}):a.claudeBlock&&(a.claudeBlock.source={type:"base64",media_type:c.mimeType,data:c.url.split(",")[1]}),k++)}return k}},81297:(a,b,c)=>{c.d(b,{X:()=>m});var d=c(69152);let e={vision:"[image omitted: model has no vision support]",audioInput:"[audio omitted: model has no audio support]",pdf:"[file omitted: model has no document support]"},f={vision:"[Previous image omitted from context.]",audioInput:"[Previous audio omitted from context.]",pdf:"[Previous file omitted from context.]"},g=(a,b)=>(b?e:f)[a];function h(a){let b=a?.type;return"image_url"===b||"image"===b?"vision":"input_audio"===b||"audio_url"===b?"audioInput":"file"===b?"pdf":null}function i(a){let b=a?.type;return"image"===b?"vision":"document"===b?"pdf":null}function j(a,b,c,d,e){let f=[];for(let e of a){let a=b(e);if(a&&!1===c[a]){d.add(a);continue}f.push(e)}for(let a of d)f.push({type:"text",text:g(a,e)});return f}function k(a,b){if(!Array.isArray(a.messages))return;let c=a.messages.length-1;a.messages.forEach((a,d)=>{if(!Array.isArray(a.content))return;let e=new Set;a.content=j(a.content,h,b,e,d===c)})}function l(a,b){if(!Array.isArray(a))return;let c=a.length-1;a.forEach((a,d)=>{if(!Array.isArray(a.parts))return;let e=new Set;for(let f of(a.parts=a.parts.filter(a=>{var c;let d="string"!=typeof(c=a?.inlineData?.mimeType||a?.fileData?.mimeType)?null:c.startsWith("image/")?"vision":c.startsWith("audio/")?"audioInput":"application/pdf"===c?"pdf":null;return!d||!1!==b[d]||(e.add(d),!1)}),e))a.parts.push({text:g(f,d===c)})})}function m(a,b,c){if(!a||!c||!1!==c.vision&&!1!==c.audioInput&&!1!==c.pdf)return!1;switch(b){case d.h.OPENAI:case d.h.OLLAMA:case d.h.KIRO:case d.h.CURSOR:case d.h.COMMANDCODE:k(a,c);break;case d.h.CLAUDE:!function(a,b){if(!Array.isArray(a.messages))return;let c=a.messages.length-1;a.messages.forEach((a,d)=>{if(!Array.isArray(a.content))return;let e=new Set;a.content=j(a.content,i,b,e,d===c)})}(a,c);break;case d.h.OPENAI_RESPONSES:case d.h.OPENAI_RESPONSE:case d.h.CODEX:!function(a,b){if(!Array.isArray(a.input))return;let c=a.input.length-1;a.input.forEach((a,d)=>{if(!Array.isArray(a.content))return;let e=new Set;for(let f of(a.content=a.content.filter(a=>{let c=a?.type==="input_image"?"vision":a?.type==="input_file"?"pdf":null;return!c||!1!==b[c]||(e.add(c),!1)}),e))a.content.push({type:"input_text",text:g(f,d===c)})})}(a,c);break;case d.h.GEMINI:case d.h.GEMINI_CLI:case d.h.VERTEX:l(a.contents,c);break;case d.h.ANTIGRAVITY:l(a?.request?.contents,c);break;default:k(a,c)}return!0}},83571:(a,b,c)=>{c.d(b,{c:()=>i});var d=c(54729),e=c(56974),f=c(69152),g=c(92398),h=c(67860);function i(a,b,c="",e=!1){if(!c.includes("claude-cli")||!a.messages?.length)return null;let f=a.messages,h=a=>"string"==typeof a?a:Array.isArray(a)?a.filter(a=>"text"===a.type).map(a=>a.text).join(" "):"",j=!1,m=!1,n=f[f.length-1];if(n?.role==="assistant"&&n.content?.[0]?.text==="{"&&(j=!0),j||"Warmup"===h(f[0]?.content)&&(j=!0),j||1!==f.length||f[0]?.role!=="user"||"count"===h(f[0]?.content)&&(j=!0),!j&&g.C8?.length){let a=f.filter(a=>"user"===a.role).map(a=>h(a.content)).join(" ");g.C8.some(b=>a.includes(b))&&(j=!0)}if(!j&&e){let b=f.find(a=>"system"===a.role),c=h(b?.content),d=Array.isArray(a.system)?a.system.filter(a=>"text"===a.type).map(a=>a.text).join(" "):"string"==typeof a.system?a.system:"";(c||d).includes("isNewTopic")&&(j=!0,m=!0)}if(!j)return null;let o=(0,d.Tz)(a),p=!1!==a.stream;if(m){let a=f.find(a=>"user"===a.role),c=JSON.stringify({isNewTopic:!0,title:h(a?.content).trim().split(/\s+/).slice(0,3).join(" ")});return p?l(o,b,c):k(o,b,c)}return p?l(o,b):k(o,b)}function j(a,b="CLI Command Execution: Clear Terminal"){return{id:`chatcmpl-${Date.now()}`,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:a,choices:[{index:0,message:{role:"assistant",content:b},finish_reason:"stop"}],usage:{prompt_tokens:1,completion_tokens:1,total_tokens:2}}}function k(a,b,c){let d=j(b,c);if(a===f.h.OPENAI)return{success:!0,response:new Response(JSON.stringify(d),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})};let g=(0,e.Ws)(a);g.model=b;let h=m(d),i=[];for(let b of h){let c=(0,e.Y8)(f.h.OPENAI,a,b,g);c?.length>0&&i.push(...c)}let k=(0,e.Y8)(f.h.OPENAI,a,null,g);return k?.length>0&&i.push(...k),{success:!0,response:new Response(JSON.stringify(function(a,b){if(!a||0===a.length)return j("unknown");let c=a[a.length-1];if(b===f.h.CLAUDE&&a.find(a=>"message_stop"===a.type)){a.find(a=>"content_block_delta"===a.type);let b=a.find(a=>"message_delta"===a.type),d=a.find(a=>"message_start"===a.type);if(d?.message){c=d.message;let a=d.message.usage,e=b?.usage;(a||e)&&(c.usage={...a||{},...e||{},...a?.cache_read_input_tokens!==void 0?{cache_read_input_tokens:a.cache_read_input_tokens}:{},...a?.cache_creation_input_tokens!==void 0?{cache_creation_input_tokens:a.cache_creation_input_tokens}:{},...a?.input_tokens!==void 0?{input_tokens:a.input_tokens}:{}})}}return c}(i,a)),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}function l(a,b,c){let d=j(b,c),g=(0,e.Ws)(a);g.model=b;let i=m(d),k=[];for(let b of i){let c=(0,e.Y8)(f.h.OPENAI,a,b,g);if(c?.length>0)for(let b of c)k.push((0,h.v8)(b,a))}let l=(0,e.Y8)(f.h.OPENAI,a,null,g);if(l?.length>0)for(let b of l)k.push((0,h.v8)(b,a));return k.push("data: [DONE]\n\n"),{success:!0,response:new Response(k.join(""),{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive","Access-Control-Allow-Origin":"*"}})}}function m(a){let{id:b,created:c,model:d,choices:e}=a;return[{id:b,object:"chat.completion.chunk",created:c,model:d,choices:[{index:0,delta:{role:"assistant",content:e[0].message.content},finish_reason:null}]},{id:b,object:"chat.completion.chunk",created:c,model:d,choices:[{index:0,delta:{},finish_reason:"stop"}],usage:a.usage}]}},86954:(a,b,c)=>{c.d(b,{q:()=>m});let d="u">typeof process&&process.versions?.node&&!0,e="u">typeof process&&process.env?.ENABLE_REQUEST_LOGS==="true",f=null,g=null,h=null;async function i(){if(d&&e&&!f)try{f=await Promise.resolve().then(c.t.bind(c,29021,23)),h=(g=await Promise.resolve().then(c.t.bind(c,33873,23))).join("u">typeof process&&process.cwd?process.cwd():".","logs")}catch{}}async function j(a,b,c){if(!d||!e||(await i(),!f||!h))return null;try{f.existsSync(h)||f.mkdirSync(h,{recursive:!0});let d=function(a=new Date){let b=a=>String(a).padStart(2,"0"),c=a.getFullYear(),d=b(a.getMonth()+1),e=b(a.getDate()),f=b(a.getHours()),g=b(a.getMinutes()),h=b(a.getSeconds()),i=String(a.getMilliseconds()).padStart(3,"0");return`${c}${d}${e}_${f}${g}${h}_${i}`}(),e=(c||"unknown").replace(/[/:]/g,"-"),i=`${a}_${b}_${e}_${d}`,j=g.join(h,i);return f.mkdirSync(j,{recursive:!0}),j}catch(a){return console.log("[LOG] Failed to create log session:",a.message),null}}function k(a,b,c){if(f&&a)try{let d=g.join(a,b);f.writeFileSync(d,JSON.stringify(c,null,2))}catch(a){console.log(`[LOG] Failed to write ${b}:`,a.message)}}function l(a){return a?{...a}:{}}async function m(a,b,c){if(!e)return{sessionPath:null,logClientRawRequest(){},logRawRequest(){},logOpenAIRequest(){},logTargetRequest(){},logProviderResponse(){},appendProviderChunk(){},appendOpenAIChunk(){},logConvertedResponse(){},appendConvertedChunk(){},logError(){}};let d=await j(a,b,c);return{get sessionPath(){return d},logClientRawRequest(a,b,c={}){k(d,"1_req_client.json",{timestamp:new Date().toISOString(),endpoint:a,headers:l(c),body:b})},logRawRequest(a,b={}){k(d,"2_req_source.json",{timestamp:new Date().toISOString(),headers:l(b),body:a})},logOpenAIRequest(a){k(d,"3_req_openai.json",{timestamp:new Date().toISOString(),body:a})},logTargetRequest(a,b,c){k(d,"4_req_target.json",{timestamp:new Date().toISOString(),url:a,headers:l(b),body:c})},logProviderResponse(a,b,c,e){k(d,"5_res_provider.json",{timestamp:new Date().toISOString(),status:a,statusText:b,headers:c?"function"==typeof c.entries?Object.fromEntries(c.entries()):c:{},body:e})},appendProviderChunk(a){if(f&&d)try{let b=g.join(d,"5_res_provider.txt");f.appendFileSync(b,a)}catch(a){}},appendOpenAIChunk(a){if(f&&d)try{let b=g.join(d,"6_res_openai.txt");f.appendFileSync(b,a)}catch(a){}},logConvertedResponse(a){k(d,"7_res_client.json",{timestamp:new Date().toISOString(),body:a})},appendConvertedChunk(a){if(f&&d)try{let b=g.join(d,"7_res_client.txt");f.appendFileSync(b,a)}catch(a){}},logError(a,b=null){k(d,"6_error.json",{timestamp:new Date().toISOString(),error:a?.message||String(a),stack:a?.stack,requestBody:b})}}}},92201:(a,b,c)=>{c.d(b,{y:()=>f});var d=c(2933);let e=new TextEncoder;function f(a){let b=a?.choices?.[0],c=b?.message;if(!c)return new Response(new ReadableStream({start(b){b.enqueue(e.encode(`data: ${JSON.stringify(a)}
68
+ `),h.replace(/\n+$/,"")}s.filterName="search-list";let t=/^Result of search in '[^']*' \(total (\d+) files?\):/,u=/^diff --git /m,v=/^@@ /m,w=/^On branch |^nothing to commit|^Changes (not |to be )|^Untracked files:/m,x=/^[*|/\\ ]*commit [0-9a-f]{7,40}$/m,y=/^[ MADRCU?!][ MADRCU?!] \S/m,z=/^(npm (warn|error|ERR!)|yarn (warn|error)|\s*Compiling\s+\S+|\s*Downloading\s+\S+|added \d+ package|\[ERROR\]|BUILD (SUCCESS|FAILED)|\s*Finished\s+|Successfully (installed|built)|ERROR:)/im,A=/[├└]──|│ /,B=/^[-dlbcps][rwx-]{9}/m,C=/^total \d+$/m;function D(a){let b=a.indexOf(":");if(-1===b)return!1;let c=a.indexOf(":",b+1);if(-1===c)return!1;let d=a.slice(b+1,c);return/^\d+$/.test(d)}function E(a){let b=a.trim();return 0!==b.length&&(!!/^[A-Za-z]:[\\/]/.test(b)||!b.includes(":")&&(b.startsWith(".")||b.startsWith("/")||b.includes("/")))}function F(a,b){if(void 0===b&&(b=!1),!b||!a)return null;if(a.conversationState){var c=a;let b={bytesBefore:0,bytesAfter:0,hits:[]};try{let a=c.conversationState,d=[...Array.isArray(a?.history)?a.history:[]];for(let c of(a?.currentMessage&&d.push(a.currentMessage),d)){let a=c?.userInputMessage?.userInputMessageContext?.toolResults;if(Array.isArray(a)){for(let c of a)if("error"!==c.status&&Array.isArray(c.content))for(let a of c.content)a&&"string"==typeof a.text&&(a.text=G(a.text,b,"kiro-tool-result"))}}}catch(a){return console.warn("[RTK] compressKiroFormat error:",a.message),null}return b}let d=Array.isArray(a.messages)?a.messages:Array.isArray(a.input)?a.input:null;if(!d)return null;let e={bytesBefore:0,bytesAfter:0,hits:[]};try{for(let a=0;a<d.length;a++){let b=d[a];if(b){if("function_call_output"===b.type){if("string"==typeof b.output)b.output=G(b.output,e,"openai-responses-string");else if(Array.isArray(b.output))for(let a=0;a<b.output.length;a++){let c=b.output[a];c&&"input_text"===c.type&&"string"==typeof c.text&&(c.text=G(c.text,e,"openai-responses-array"))}continue}if("tool"===b.role&&"string"==typeof b.content){b.content=G(b.content,e,"openai-tool");continue}if(Array.isArray(b.content)){if("tool"===b.role){for(let a=0;a<b.content.length;a++){let c=b.content[a];c&&"text"===c.type&&"string"==typeof c.text&&(c.text=G(c.text,e,"openai-tool-array"))}continue}for(let a=0;a<b.content.length;a++){let c=b.content[a];if(c&&"tool_result"===c.type&&!0!==c.is_error){if("string"==typeof c.content)c.content=G(c.content,e,"claude-string");else if(Array.isArray(c.content))for(let a=0;a<c.content.length;a++){let b=c.content[a];b&&"text"===b.type&&"string"==typeof b.text&&(b.text=G(b.text,e,"claude-array"))}}}}}}}catch(a){return console.warn("[RTK] compressMessages error:",a.message),null}return e}function G(a,b,c){let d=a.length;if(b.bytesBefore+=d,d<500||d>0xa00000)return b.bytesAfter+=d,a;let h=function(a){var b,c;let d,h,m=a.length>1024?a.slice(0,1024):a;if(x.test(m))return g;if(u.test(m)||v.test(m))return e;if(w.test(m))return f;if(z.test(m))return i;if(!((d=m.split("\n").filter(a=>a.trim())).length<3)&&d.filter(a=>y.test(a)).length/d.length>=.6)return f;let F=m.split("\n"),G=F.filter(a=>a.trim().length>0);return G.slice(0,5).some(D)?j:G.length>=3&&G.every(E)?k:A.test(m)?o:C.test(m)||(b=m,h=new RegExp((c=B).source,c.flags.includes("g")?c.flags:c.flags+"g"),(b.match(h)||[]).length>=3)?n:t.test(m)?s:F.length>=250&&function(a){let b=0,c=0;for(let d of a.slice(0,100))0!==d.length&&(c++,r.test(d)&&b++);return!(c<5)&&b/c>=.7}(F)?q:G.length>=5?l:a.split("\n").length>=250?p:null}(a);if(!h)return b.bytesAfter+=d,a;let m=function(a,b){if("function"!=typeof a)return b;try{let c=a(b);if("string"!=typeof c)return b;return c}catch(d){let c=a.filterName||a.name||"anonymous";return console.warn(`[rtk] warning: filter '${c}' panicked — passing through raw output: ${d?.message||d}`),b}}(h,a);return!m||0===m.length||m.length>=d?(b.bytesAfter+=d,a):(b.bytesAfter+=m.length,b.hits.push({shape:c,filter:h.filterName||h.name,saved:d-m.length}),m)}function H(a){if(!a||!a.hits||0===a.hits.length)return null;let b=a.bytesBefore-a.bytesAfter,c=a.bytesBefore>0?(b/a.bytesBefore*100).toFixed(1):"0",d=Array.from(new Set(a.hits.map(a=>a.filter))).join(",");return`[RTK] saved ${b}B / ${a.bytesBefore}B (${c}%) via [${d}] hits=${a.hits.length}`}},77380:(a,b,c)=>{c.d(b,{vH:()=>f});let d="functions.";function e(a){let b=a.indexOf(d);return -1===b?{prefix:a,tail:""}:{prefix:a.slice(0,b).trim(),tail:a.slice(b)}}function f(a){let b=a?.content,c="string"==typeof b?b:"";if(Array.isArray(a?.tool_calls)&&a.tool_calls.length>0)return{message:{...a},hasTools:!0,originalContent:c};let f=function(a){if(!("string"==typeof a&&0!==a.length&&a.includes(d)))return[];let{tail:b}=e(a);if(!b)return[];let c=[],f=b,g=0;for(;f.length>0&&c.length<64&&f.startsWith(d);){let a=(f=f.slice(d.length)).indexOf(d),b=function(a,b){let c;if("string"!=typeof a||0===a.length)return null;let d=a.indexOf("{");if(-1===d)return null;let e=a.slice(0,d).trim(),f=a.slice(d),g=e.match(/^([a-zA-Z0-9_\-/.]+)(?::([a-zA-Z0-9_\-]+))?$/);if(!g)return null;let h=g[1],i=g[2];try{c=function(a){let b=0,c=!1,d=!1,e=-1;for(let f=0;f<a.length;f++){let g=a[f];if(c){if(d){d=!1;continue}if("\\"===g){d=!0;continue}'"'===g&&(c=!1);continue}if('"'===g){c=!0;continue}if("{"===g){1==++b&&(e=-1);continue}if("}"===g){if(0==--b){e=f+1;break}continue}}if(-1===e)throw Error("unbalanced JSON object");return JSON.parse(a.slice(0,e))}(f)}catch{return null}return{id:i?`functions.${h}:${i}`:`functions.${h}:${b}`,type:"function",function:{name:h,arguments:JSON.stringify(c)}}}(-1===a?f:f.slice(0,a),g);if(!b||(c.push(b),g++,-1===a))break;f=f.slice(a)}return c}(c);if(0===f.length)return{message:{...a},hasTools:!1,originalContent:c};let{prefix:g}=e(c);return{message:{...a,content:g,tool_calls:f},hasTools:!0,originalContent:c}}},78963:(a,b,c)=>{c.d(b,{Jb:()=>g,jd:()=>f});var d=c(92398),e=c(25440);function f({onDisconnect:a,onError:b,log:c,provider:d,model:g}={}){let h=new AbortController,i=Date.now(),j=!1,k=null,l=a=>{let b=Date.now()-i,c=d?.toUpperCase()||"UNKNOWN";console.log(`[${new Date().toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}] 🌊 [STREAM] ${c} | ${g||"unknown"} | ${b}ms | ${a}`)};return{signal:h.signal,startTime:i,isConnected:()=>!j,handleDisconnect:(b="client_closed")=>{j||(j=!0,l(`disconnect: ${b}`),(0,e.s)("CTRL",`${d}/${g} | disconnect=${b} | dur=${Date.now()-i}ms`),k=setTimeout(()=>{h.abort()},500),a?.({reason:b,duration:Date.now()-i}))},handleComplete:()=>{!j&&(j=!0,l("complete"),k&&(clearTimeout(k),k=null))},handleError:a=>{if(!j){if(j=!0,k&&(clearTimeout(k),k=null),"AbortError"===a.name)return void l("aborted");l(`error: ${a.message}`),b?.(a)}},abort:()=>h.abort()}}function g(a,b,c,f=null,h=d.xM){let i=null,j=0,k=0,l=Date.now(),m=Date.now(),n="STREAM",o=()=>{i&&(clearTimeout(i),i=null)},p=()=>{o(),i=setTimeout(()=>{i=null,(0,e.s)(n,`STALL TIMEOUT ${h}ms | chunks=${j} | bytes=${k} | sinceLast=${Date.now()-l}ms`),c.handleError?.(Error("stream stall timeout")),c.abort?.()},h)},q={signal:c.signal,startTime:c.startTime,isConnected:()=>c.isConnected(),handleComplete:()=>{(0,e.s)(n,`complete | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o(),c.handleComplete()},handleError:a=>{(0,e.s)(n,`error: ${a?.message} | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o(),c.handleError(a)},handleDisconnect:a=>{(0,e.s)(n,`disconnect: ${a} | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o(),c.handleDisconnect(a)},abort:()=>{o(),c.abort()}};p(),(0,e.s)(n,`pipe start | stallTimeout=${h}ms`);let r=new TransformStream({transform(a,b){j++;let c=a?.byteLength||a?.length||0;k+=c;let d=Date.now(),f=d-l;l=d,e.T&&(j<=5||j%20==0||f>5e3)&&(0,e.s)(n,`chunk #${j} | size=${c}B | gap=${f}ms | total=${k}B`),p(),b.enqueue(a)},flush(){(0,e.s)(n,`upstream EOF | chunks=${j} | bytes=${k} | dur=${Date.now()-m}ms`),o()}});return function(a,b,c=null){let d=a.readable.getReader(),e=a.writable.getWriter(),f=!1,g=a=>{if(!f&&c){f=!0;try{let b=c();b&&a.enqueue(b)}catch{}}};return new ReadableStream({async pull(a){if(!b.isConnected()){g(a),a.close();return}try{let{done:c,value:e}=await d.read();if(c){b.handleComplete(),a.close();return}a.enqueue(e)}catch(l){let f=b.isConnected(),h=l?.message||"";h.includes("already closed")||h.includes("Invalid state")||b.handleError(l),d.cancel().catch(()=>{}),e.abort().catch(()=>{});let i=l?.message||"",j=l?.code||l?.cause?.code||"",k="AbortError"===l.name||i.includes("aborted")||i.includes("socket hang up")||i.includes("ECONNRESET")||i.includes("ETIMEDOUT")||i.includes("EPIPE")||"ECONNRESET"===j||"ETIMEDOUT"===j||"EPIPE"===j||"UND_ERR_SOCKET"===j;try{!f||k||c?(g(a),a.close()):a.error(l)}catch(a){}}},cancel(a){b.handleDisconnect(a||"cancelled"),d.cancel(),e.abort()}})}({readable:a.body.pipeThrough(r).pipeThrough(b),writable:{getWriter:()=>({abort:()=>Promise.resolve()})}},q,f)}},80117:(a,b,c)=>{c.d(b,{C:()=>h});var d=c(69152),e=c(99067);let f=new Set([d.h.GEMINI,d.h.GEMINI_CLI,d.h.VERTEX,d.h.ANTIGRAVITY,d.h.OLLAMA,d.h.KIRO]);function g(a){return"string"==typeof a&&(a.startsWith("http://")||a.startsWith("https://"))}async function h(a,b,c,i={}){if(!a||!f.has(c))return 0;let j=function(a,b){let c=[],e=a=>{for(let b of a||[])if(Array.isArray(b.content)){for(let a of b.content)if(a?.type==="image_url"){let b="string"==typeof a.image_url?a.image_url:a.image_url?.url;g(b)&&c.push({get:()=>b,set:b=>{"string"==typeof a.image_url?a.image_url=b:a.image_url.url=b}})}}},f=a=>{for(let b of a||[])for(let a of b.parts||[]){let b=a?.fileData?.fileUri;g(b)&&c.push({get:()=>b,part:a})}};switch(b){case d.h.OPENAI:case d.h.OLLAMA:case d.h.KIRO:case d.h.CURSOR:case d.h.COMMANDCODE:e(a.messages);break;case d.h.CLAUDE:for(let b of a.messages||[])if(Array.isArray(b.content))for(let a of b.content)a?.type==="image"&&a.source?.type==="url"&&g(a.source.url)&&c.push({get:()=>a.source.url,claudeBlock:a});break;case d.h.GEMINI:case d.h.GEMINI_CLI:case d.h.VERTEX:f(a.contents);break;case d.h.ANTIGRAVITY:f(a?.request?.contents);break;default:e(a.messages)}return c}(a,b);if(!j.length)return 0;let k=0;for(let a of j){let b=a.get();if((0,e.W$)(b))continue;let c=await (0,e.ni)(b,i);c&&(a.set?a.set(c.url):a.part?(delete a.part.fileData,a.part.inlineData={mimeType:c.mimeType,data:c.url.split(",")[1]}):a.claudeBlock&&(a.claudeBlock.source={type:"base64",media_type:c.mimeType,data:c.url.split(",")[1]}),k++)}return k}},81297:(a,b,c)=>{c.d(b,{X:()=>m});var d=c(69152);let e={vision:"[image omitted: model has no vision support]",audioInput:"[audio omitted: model has no audio support]",pdf:"[file omitted: model has no document support]"},f={vision:"[Previous image omitted from context.]",audioInput:"[Previous audio omitted from context.]",pdf:"[Previous file omitted from context.]"},g=(a,b)=>(b?e:f)[a];function h(a){let b=a?.type;return"image_url"===b||"image"===b?"vision":"input_audio"===b||"audio_url"===b?"audioInput":"file"===b?"pdf":null}function i(a){let b=a?.type;return"image"===b?"vision":"document"===b?"pdf":null}function j(a,b,c,d,e){let f=[];for(let e of a){let a=b(e);if(a&&!1===c[a]){d.add(a);continue}f.push(e)}for(let a of d)f.push({type:"text",text:g(a,e)});return f}function k(a,b){if(!Array.isArray(a.messages))return;let c=a.messages.length-1;a.messages.forEach((a,d)=>{if(!Array.isArray(a.content))return;let e=new Set;a.content=j(a.content,h,b,e,d===c)})}function l(a,b){if(!Array.isArray(a))return;let c=a.length-1;a.forEach((a,d)=>{if(!Array.isArray(a.parts))return;let e=new Set;for(let f of(a.parts=a.parts.filter(a=>{var c;let d="string"!=typeof(c=a?.inlineData?.mimeType||a?.fileData?.mimeType)?null:c.startsWith("image/")?"vision":c.startsWith("audio/")?"audioInput":"application/pdf"===c?"pdf":null;return!d||!1!==b[d]||(e.add(d),!1)}),e))a.parts.push({text:g(f,d===c)})})}function m(a,b,c){if(!a||!c||!1!==c.vision&&!1!==c.audioInput&&!1!==c.pdf)return!1;switch(b){case d.h.OPENAI:case d.h.OLLAMA:case d.h.KIRO:case d.h.CURSOR:case d.h.COMMANDCODE:k(a,c);break;case d.h.CLAUDE:!function(a,b){if(!Array.isArray(a.messages))return;let c=a.messages.length-1;a.messages.forEach((a,d)=>{if(!Array.isArray(a.content))return;let e=new Set;a.content=j(a.content,i,b,e,d===c)})}(a,c);break;case d.h.OPENAI_RESPONSES:case d.h.OPENAI_RESPONSE:case d.h.CODEX:!function(a,b){if(!Array.isArray(a.input))return;let c=a.input.length-1;a.input.forEach((a,d)=>{if(!Array.isArray(a.content))return;let e=new Set;for(let f of(a.content=a.content.filter(a=>{let c=a?.type==="input_image"?"vision":a?.type==="input_file"?"pdf":null;return!c||!1!==b[c]||(e.add(c),!1)}),e))a.content.push({type:"input_text",text:g(f,d===c)})})}(a,c);break;case d.h.GEMINI:case d.h.GEMINI_CLI:case d.h.VERTEX:l(a.contents,c);break;case d.h.ANTIGRAVITY:l(a?.request?.contents,c);break;default:k(a,c)}return!0}},83571:(a,b,c)=>{c.d(b,{c:()=>i});var d=c(54729),e=c(56974),f=c(69152),g=c(92398),h=c(45479);function i(a,b,c="",e=!1){if(!c.includes("claude-cli")||!a.messages?.length)return null;let f=a.messages,h=a=>"string"==typeof a?a:Array.isArray(a)?a.filter(a=>"text"===a.type).map(a=>a.text).join(" "):"",j=!1,m=!1,n=f[f.length-1];if(n?.role==="assistant"&&n.content?.[0]?.text==="{"&&(j=!0),j||"Warmup"===h(f[0]?.content)&&(j=!0),j||1!==f.length||f[0]?.role!=="user"||"count"===h(f[0]?.content)&&(j=!0),!j&&g.C8?.length){let a=f.filter(a=>"user"===a.role).map(a=>h(a.content)).join(" ");g.C8.some(b=>a.includes(b))&&(j=!0)}if(!j&&e){let b=f.find(a=>"system"===a.role),c=h(b?.content),d=Array.isArray(a.system)?a.system.filter(a=>"text"===a.type).map(a=>a.text).join(" "):"string"==typeof a.system?a.system:"";(c||d).includes("isNewTopic")&&(j=!0,m=!0)}if(!j)return null;let o=(0,d.Tz)(a),p=!1!==a.stream;if(m){let a=f.find(a=>"user"===a.role),c=JSON.stringify({isNewTopic:!0,title:h(a?.content).trim().split(/\s+/).slice(0,3).join(" ")});return p?l(o,b,c):k(o,b,c)}return p?l(o,b):k(o,b)}function j(a,b="CLI Command Execution: Clear Terminal"){return{id:`chatcmpl-${Date.now()}`,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:a,choices:[{index:0,message:{role:"assistant",content:b},finish_reason:"stop"}],usage:{prompt_tokens:1,completion_tokens:1,total_tokens:2}}}function k(a,b,c){let d=j(b,c);if(a===f.h.OPENAI)return{success:!0,response:new Response(JSON.stringify(d),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})};let g=(0,e.Ws)(a);g.model=b;let h=m(d),i=[];for(let b of h){let c=(0,e.Y8)(f.h.OPENAI,a,b,g);c?.length>0&&i.push(...c)}let k=(0,e.Y8)(f.h.OPENAI,a,null,g);return k?.length>0&&i.push(...k),{success:!0,response:new Response(JSON.stringify(function(a,b){if(!a||0===a.length)return j("unknown");let c=a[a.length-1];if(b===f.h.CLAUDE&&a.find(a=>"message_stop"===a.type)){a.find(a=>"content_block_delta"===a.type);let b=a.find(a=>"message_delta"===a.type),d=a.find(a=>"message_start"===a.type);if(d?.message){c=d.message;let a=d.message.usage,e=b?.usage;(a||e)&&(c.usage={...a||{},...e||{},...a?.cache_read_input_tokens!==void 0?{cache_read_input_tokens:a.cache_read_input_tokens}:{},...a?.cache_creation_input_tokens!==void 0?{cache_creation_input_tokens:a.cache_creation_input_tokens}:{},...a?.input_tokens!==void 0?{input_tokens:a.input_tokens}:{}})}}return c}(i,a)),{headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}}function l(a,b,c){let d=j(b,c),g=(0,e.Ws)(a);g.model=b;let i=m(d),k=[];for(let b of i){let c=(0,e.Y8)(f.h.OPENAI,a,b,g);if(c?.length>0)for(let b of c)k.push((0,h.v8)(b,a))}let l=(0,e.Y8)(f.h.OPENAI,a,null,g);if(l?.length>0)for(let b of l)k.push((0,h.v8)(b,a));return k.push("data: [DONE]\n\n"),{success:!0,response:new Response(k.join(""),{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive","Access-Control-Allow-Origin":"*"}})}}function m(a){let{id:b,created:c,model:d,choices:e}=a;return[{id:b,object:"chat.completion.chunk",created:c,model:d,choices:[{index:0,delta:{role:"assistant",content:e[0].message.content},finish_reason:null}]},{id:b,object:"chat.completion.chunk",created:c,model:d,choices:[{index:0,delta:{},finish_reason:"stop"}],usage:a.usage}]}},86954:(a,b,c)=>{c.d(b,{q:()=>m});let d="u">typeof process&&process.versions?.node&&!0,e="u">typeof process&&process.env?.ENABLE_REQUEST_LOGS==="true",f=null,g=null,h=null;async function i(){if(d&&e&&!f)try{f=await Promise.resolve().then(c.t.bind(c,29021,23)),h=(g=await Promise.resolve().then(c.t.bind(c,33873,23))).join("u">typeof process&&process.cwd?process.cwd():".","logs")}catch{}}async function j(a,b,c){if(!d||!e||(await i(),!f||!h))return null;try{f.existsSync(h)||f.mkdirSync(h,{recursive:!0});let d=function(a=new Date){let b=a=>String(a).padStart(2,"0"),c=a.getFullYear(),d=b(a.getMonth()+1),e=b(a.getDate()),f=b(a.getHours()),g=b(a.getMinutes()),h=b(a.getSeconds()),i=String(a.getMilliseconds()).padStart(3,"0");return`${c}${d}${e}_${f}${g}${h}_${i}`}(),e=(c||"unknown").replace(/[/:]/g,"-"),i=`${a}_${b}_${e}_${d}`,j=g.join(h,i);return f.mkdirSync(j,{recursive:!0}),j}catch(a){return console.log("[LOG] Failed to create log session:",a.message),null}}function k(a,b,c){if(f&&a)try{let d=g.join(a,b);f.writeFileSync(d,JSON.stringify(c,null,2))}catch(a){console.log(`[LOG] Failed to write ${b}:`,a.message)}}function l(a){return a?{...a}:{}}async function m(a,b,c){if(!e)return{sessionPath:null,logClientRawRequest(){},logRawRequest(){},logOpenAIRequest(){},logTargetRequest(){},logProviderResponse(){},appendProviderChunk(){},appendOpenAIChunk(){},logConvertedResponse(){},appendConvertedChunk(){},logError(){}};let d=await j(a,b,c);return{get sessionPath(){return d},logClientRawRequest(a,b,c={}){k(d,"1_req_client.json",{timestamp:new Date().toISOString(),endpoint:a,headers:l(c),body:b})},logRawRequest(a,b={}){k(d,"2_req_source.json",{timestamp:new Date().toISOString(),headers:l(b),body:a})},logOpenAIRequest(a){k(d,"3_req_openai.json",{timestamp:new Date().toISOString(),body:a})},logTargetRequest(a,b,c){k(d,"4_req_target.json",{timestamp:new Date().toISOString(),url:a,headers:l(b),body:c})},logProviderResponse(a,b,c,e){k(d,"5_res_provider.json",{timestamp:new Date().toISOString(),status:a,statusText:b,headers:c?"function"==typeof c.entries?Object.fromEntries(c.entries()):c:{},body:e})},appendProviderChunk(a){if(f&&d)try{let b=g.join(d,"5_res_provider.txt");f.appendFileSync(b,a)}catch(a){}},appendOpenAIChunk(a){if(f&&d)try{let b=g.join(d,"6_res_openai.txt");f.appendFileSync(b,a)}catch(a){}},logConvertedResponse(a){k(d,"7_res_client.json",{timestamp:new Date().toISOString(),body:a})},appendConvertedChunk(a){if(f&&d)try{let b=g.join(d,"7_res_client.txt");f.appendFileSync(b,a)}catch(a){}},logError(a,b=null){k(d,"6_error.json",{timestamp:new Date().toISOString(),error:a?.message||String(a),stack:a?.stack,requestBody:b})}}}},92201:(a,b,c)=>{c.d(b,{y:()=>f});var d=c(2933);let e=new TextEncoder;function f(a){let b=a?.choices?.[0],c=b?.message;if(!c)return new Response(new ReadableStream({start(b){b.enqueue(e.encode(`data: ${JSON.stringify(a)}
69
69
 
70
70
  data: [DONE]
71
71
 
72
72
  `)),b.close()}}),{headers:d.RK});let f=a.id||`chatcmpl-${Date.now()}`,g=a.created||Math.floor(Date.now()/1e3),h=a.model||"unknown",i=[];i.push({id:f,object:"chat.completion.chunk",created:g,model:h,choices:[{index:0,delta:{role:"assistant"},finish_reason:null,logprobs:null}]}),c.reasoning_content&&i.push({id:f,object:"chat.completion.chunk",created:g,model:h,choices:[{index:0,delta:{reasoning_content:c.reasoning_content},finish_reason:null,logprobs:null}]}),c.content&&i.push({id:f,object:"chat.completion.chunk",created:g,model:h,choices:[{index:0,delta:{content:c.content},finish_reason:null,logprobs:null}]}),c.tool_calls?.length>0&&i.push({id:f,object:"chat.completion.chunk",created:g,model:h,choices:[{index:0,delta:{tool_calls:c.tool_calls},finish_reason:null,logprobs:null}]});let j={id:f,object:"chat.completion.chunk",created:g,model:h,choices:[{index:0,delta:{},finish_reason:b.finish_reason||"stop",logprobs:null}]};return a.usage&&(j.usage=a.usage),i.push(j),new Response(new ReadableStream({start(a){for(let b of i)a.enqueue(e.encode(`data: ${JSON.stringify(b)}
73
73
 
74
- `));a.enqueue(e.encode("data: [DONE]\n\n")),a.close()}}),{headers:d.RK})}},92557:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{SB:()=>f.SB}),c(2607),c(13946),c(22830),c(92398),c(85577),c(69152),c(56974),c(54729),c(23095),c(5505),c(91392),c(28765);var e=c(36110);c(78963);var f=c(63548);c(15261),c(67860);var g=a([e,f]);[e,f]=g.then?(await g)():g,d()}catch(a){d(a)}})},92913:(a,b,c)=>{c.d(b,{$R:()=>j,Fo:()=>h,MK:()=>i,qr:()=>k});var d=c(23648),e=c(67860),f=c(73329);let g=["temperature","top_p","top_k","max_tokens","max_completion_tokens","thinking","reasoning","enable_thinking","presence_penalty","frequency_penalty","seed","stop","tools","tool_choice","response_format","prediction","store","metadata","n","logprobs","top_logprobs","logit_bias","user","parallel_tool_calls"];function h(a,b){let c={messages:a.messages||[],model:a.model,stream:b};for(let b of g)void 0!==a[b]&&(c[b]=a[b]);return c}function i(a){return a&&"object"==typeof a?a.usage?.input_tokens!==void 0?{prompt_tokens:a.usage.input_tokens||0,completion_tokens:a.usage.output_tokens||0,cache_read_input_tokens:a.usage.cache_read_input_tokens,cache_creation_input_tokens:a.usage.cache_creation_input_tokens}:a.usage?.prompt_tokens!==void 0?{prompt_tokens:a.usage.prompt_tokens||0,completion_tokens:a.usage.completion_tokens||0,cached_tokens:a.usage.prompt_tokens_details?.cached_tokens,reasoning_tokens:a.usage.completion_tokens_details?.reasoning_tokens}:a.usageMetadata?{prompt_tokens:a.usageMetadata.promptTokenCount||0,completion_tokens:a.usageMetadata.candidatesTokenCount||0,cached_tokens:a.usageMetadata.cachedContentTokenCount||0,reasoning_tokens:a.usageMetadata.thoughtsTokenCount||0}:null:null}function j(a,b={}){return{provider:a.provider||"unknown",model:a.model||"unknown",connectionId:a.connectionId||void 0,apiKey:a.apiKey||null,apiKeyName:a.apiKeyName||null,timestamp:new Date().toISOString(),latency:a.latency||{ttft:0,total:0},tokens:a.tokens||{prompt_tokens:0,completion_tokens:0},request:a.request,providerRequest:a.providerRequest||null,providerResponse:a.providerResponse||null,response:a.response||{},pxpipe:a.pxpipe||void 0,status:a.status||"success",...b}}function k({provider:a,model:b,tokens:c,connectionId:g,apiKey:h,endpoint:i,label:j="USAGE"}){if(!c||"object"!=typeof c)return;let l=c.input_tokens??c.prompt_tokens??0,m=c.output_tokens??c.completion_tokens??0;if(0===l&&0===m)return;let n=new Date().toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),o=g?` | account=${g.slice(0,8)}...`:"";console.log(`${e.lm.green}[${n}] 📊 [${j}] ${a.toUpperCase()} | in=${l} | out=${m}${o}${e.lm.reset}`);let p=(0,f._6)(c)||{prompt_tokens:c.prompt_tokens??c.input_tokens??0,completion_tokens:c.completion_tokens??c.output_tokens??0};(0,d.sZ)({provider:a||"unknown",model:b||"unknown",tokens:p,timestamp:new Date().toISOString(),connectionId:g||void 0,apiKey:h||void 0,endpoint:i||null}).catch(()=>{})}},94054:(a,b,c)=>{c.d(b,{J:()=>e,Q:()=>f});let d={claude:["claude","anthropic"],"gemini-cli":["gemini-cli"],antigravity:["antigravity"],codex:["codex"]};function e(a={},b={}){let c=(a["user-agent"]||"").toLowerCase(),d=(a["x-app"]||"").toLowerCase(),f=(a["openai-intent"]||"").toLowerCase(),g=(a["x-initiator"]||a["X-Initiator"]||"").toLowerCase();return"antigravity"===b.userAgent?"antigravity":c.includes("githubcopilotchat")||"conversation-panel"===f||"user"===g?"github-copilot":c.includes("claude-cli")||c.includes("claude-code")||"cli"===d?"claude":c.includes("gemini-cli")?"gemini-cli":c.includes("codex-cli")?"codex":c.includes("deepseek-tui")?"deepseek-tui":null}function f(a,b){if(!a)return!1;let c=d[a];if(!c)return!1;let e=b.startsWith("anthropic-compatible")?"anthropic":b;return c.includes(e)}}};
74
+ `));a.enqueue(e.encode("data: [DONE]\n\n")),a.close()}}),{headers:d.RK})}},92557:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{SB:()=>f.SB}),c(2607),c(13946),c(22830),c(92398),c(85577),c(69152),c(56974),c(54729),c(23095),c(5505),c(91392),c(28765);var e=c(36110);c(78963);var f=c(63548);c(15261),c(45479);var g=a([e,f]);[e,f]=g.then?(await g)():g,d()}catch(a){d(a)}})},92913:(a,b,c)=>{c.d(b,{$R:()=>j,Fo:()=>h,MK:()=>i,qr:()=>k});var d=c(23648),e=c(45479),f=c(73329);let g=["temperature","top_p","top_k","max_tokens","max_completion_tokens","thinking","reasoning","enable_thinking","presence_penalty","frequency_penalty","seed","stop","tools","tool_choice","response_format","prediction","store","metadata","n","logprobs","top_logprobs","logit_bias","user","parallel_tool_calls"];function h(a,b){let c={messages:a.messages||[],model:a.model,stream:b};for(let b of g)void 0!==a[b]&&(c[b]=a[b]);return c}function i(a){return a&&"object"==typeof a?a.usage?.input_tokens!==void 0?{prompt_tokens:a.usage.input_tokens||0,completion_tokens:a.usage.output_tokens||0,cache_read_input_tokens:a.usage.cache_read_input_tokens,cache_creation_input_tokens:a.usage.cache_creation_input_tokens}:a.usage?.prompt_tokens!==void 0?{prompt_tokens:a.usage.prompt_tokens||0,completion_tokens:a.usage.completion_tokens||0,cached_tokens:a.usage.prompt_tokens_details?.cached_tokens,reasoning_tokens:a.usage.completion_tokens_details?.reasoning_tokens}:a.usageMetadata?{prompt_tokens:a.usageMetadata.promptTokenCount||0,completion_tokens:a.usageMetadata.candidatesTokenCount||0,cached_tokens:a.usageMetadata.cachedContentTokenCount||0,reasoning_tokens:a.usageMetadata.thoughtsTokenCount||0}:null:null}function j(a,b={}){return{provider:a.provider||"unknown",model:a.model||"unknown",connectionId:a.connectionId||void 0,apiKey:a.apiKey||null,apiKeyName:a.apiKeyName||null,timestamp:new Date().toISOString(),latency:a.latency||{ttft:0,total:0},tokens:a.tokens||{prompt_tokens:0,completion_tokens:0},request:a.request,providerRequest:a.providerRequest||null,providerResponse:a.providerResponse||null,response:a.response||{},pxpipe:a.pxpipe||void 0,status:a.status||"success",...b}}function k({provider:a,model:b,tokens:c,connectionId:g,apiKey:h,endpoint:i,label:j="USAGE"}){if(!c||"object"!=typeof c)return;let l=c.input_tokens??c.prompt_tokens??0,m=c.output_tokens??c.completion_tokens??0;if(0===l&&0===m)return;let n=new Date().toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),o=g?` | account=${g.slice(0,8)}...`:"";console.log(`${e.lm.green}[${n}] 📊 [${j}] ${a.toUpperCase()} | in=${l} | out=${m}${o}${e.lm.reset}`);let p=(0,f._6)(c)||{prompt_tokens:c.prompt_tokens??c.input_tokens??0,completion_tokens:c.completion_tokens??c.output_tokens??0};(0,d.sZ)({provider:a||"unknown",model:b||"unknown",tokens:p,timestamp:new Date().toISOString(),connectionId:g||void 0,apiKey:h||void 0,endpoint:i||null}).catch(()=>{})}},94054:(a,b,c)=>{c.d(b,{J:()=>e,Q:()=>f});let d={claude:["claude","anthropic"],"gemini-cli":["gemini-cli"],antigravity:["antigravity"],codex:["codex"]};function e(a={},b={}){let c=(a["user-agent"]||"").toLowerCase(),d=(a["x-app"]||"").toLowerCase(),f=(a["openai-intent"]||"").toLowerCase(),g=(a["x-initiator"]||a["X-Initiator"]||"").toLowerCase();return"antigravity"===b.userAgent?"antigravity":c.includes("githubcopilotchat")||"conversation-panel"===f||"user"===g?"github-copilot":c.includes("claude-cli")||c.includes("claude-code")||"cli"===d?"claude":c.includes("gemini-cli")?"gemini-cli":c.includes("codex-cli")?"codex":c.includes("deepseek-tui")?"deepseek-tui":null}function f(a,b){if(!a)return!1;let c=d[a];if(!c)return!1;let e=b.startsWith("anthropic-compatible")?"anthropic":b;return c.includes(e)}}};
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=3040,exports.ids=[3040],exports.modules={23040:(a,b,c)=>{c.d(b,{createBetterSqliteAdapter:()=>g});var d=c(87550),e=c.n(d),f=c(78785);function g(a){let b=new(e())(a);b.exec(f.oG);let c=new Map;function d(a){let d=c.get(a);return d||(d=b.prepare(a),c.set(a,d)),d}let g=setInterval(()=>{try{b.pragma("wal_checkpoint(TRUNCATE)")}catch{}},6e4);function h(){try{b.pragma("wal_checkpoint(TRUNCATE)")}catch{}try{c.clear()}catch{}try{b.close()}catch{}}"function"==typeof g.unref&&g.unref();let i=()=>h();return process.once("beforeExit",i),process.once("SIGINT",()=>{i(),process.exit(0)}),process.once("SIGTERM",()=>{i(),process.exit(0)}),{driver:"better-sqlite3",run:(a,b=[])=>d(a).run(b),get:(a,b=[])=>d(a).get(b),all:(a,b=[])=>d(a).all(b),exec:a=>b.exec(a),transaction:a=>b.transaction(a)(),checkpoint(){try{b.pragma("wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(g),h()},raw:b}}},78785:(a,b,c)=>{c.d(b,{CG:()=>f,f$:()=>d,oG:()=>e,zE:()=>g});let d=1,e=`
1
+ "use strict";exports.id=3040,exports.ids=[3040],exports.modules={23040:(a,b,c)=>{c.d(b,{createBetterSqliteAdapter:()=>g});var d=c(87550),e=c.n(d),f=c(78785);function g(a){let b=new(e())(a);b.exec(f.oG);let c=new Map;function d(a){let d=c.get(a);return d||(d=b.prepare(a),c.set(a,d)),d}let g=setInterval(()=>{try{b.pragma("wal_checkpoint(TRUNCATE)")}catch{}},6e4);function h(){try{b.pragma("wal_checkpoint(TRUNCATE)")}catch{}try{c.clear()}catch{}try{b.close()}catch{}}"function"==typeof g.unref&&g.unref();let i=()=>h();return process.once("beforeExit",i),process.once("SIGINT",()=>{i(),process.exit(0)}),process.once("SIGTERM",()=>{i(),process.exit(0)}),{driver:"better-sqlite3",run:(a,b=[])=>d(a).run(b),get:(a,b=[])=>d(a).get(b),all:(a,b=[])=>d(a).all(b),exec:a=>b.exec(a),transaction:a=>b.transaction(a)(),checkpoint(){try{b.pragma("wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(g),h()},raw:b}}},78785:(a,b,c)=>{c.d(b,{CG:()=>f,f$:()=>d,oG:()=>e,zE:()=>g});let d=2,e=`
2
2
  PRAGMA journal_mode = WAL;
3
3
  PRAGMA synchronous = NORMAL;
4
4
  PRAGMA temp_store = MEMORY;
@@ -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
- `,f={_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",apiKeyName:"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",apiKey:"TEXT",apiKeyName:"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 g(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
+ `,f={_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",apiKeyName:"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",apiKey:"TEXT",apiKeyName:"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)"]},cachedProviderModels:{columns:{providerId:"TEXT NOT NULL",modelId:"TEXT NOT NULL",kind:"TEXT DEFAULT 'llm'",ownedBy:"TEXT NOT NULL",capabilities:"TEXT",updatedAt:"INTEGER NOT NULL"},primaryKey:"PRIMARY KEY (providerId, modelId)",indexes:["CREATE INDEX IF NOT EXISTS idx_cpm_kind ON cachedProviderModels(kind)","CREATE INDEX IF NOT EXISTS idx_cpm_provider ON cachedProviderModels(providerId)"]}};function g(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,4 +1,4 @@
1
- "use strict";exports.id=3405,exports.ids=[3405],exports.modules={73405:(a,b,c)=>{c.d(b,{createBunSqliteAdapter:()=>e});var d=c(78785);async function e(a){let{Database:b}=await Promise.resolve().then(function(){var a=Error("Cannot find module 'bun:sqlite'");throw a.code="MODULE_NOT_FOUND",a}),c=new b(a,{create:!0});c.exec(d.oG);let e=new Map;function f(a){let b=e.get(a);return b||(b=c.prepare(a),e.set(a,b)),b}let g=setInterval(()=>{try{c.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);function h(){try{c.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{e.clear()}catch{}try{c.close()}catch{}}"function"==typeof g.unref&&g.unref();let i=()=>h();return process.once("beforeExit",i),process.once("SIGINT",()=>{i(),process.exit(0)}),process.once("SIGTERM",()=>{i(),process.exit(0)}),{driver:"bun:sqlite",run(a,b=[]){let c=f(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>f(a).get(...b),all:(a,b=[])=>f(a).all(...b),exec:a=>c.exec(a),transaction:a=>c.transaction(a)(),checkpoint(){try{c.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(g),h()},raw:c}}},78785:(a,b,c)=>{c.d(b,{CG:()=>f,f$:()=>d,oG:()=>e,zE:()=>g});let d=1,e=`
1
+ "use strict";exports.id=3405,exports.ids=[3405],exports.modules={73405:(a,b,c)=>{c.d(b,{createBunSqliteAdapter:()=>e});var d=c(78785);async function e(a){let{Database:b}=await Promise.resolve().then(function(){var a=Error("Cannot find module 'bun:sqlite'");throw a.code="MODULE_NOT_FOUND",a}),c=new b(a,{create:!0});c.exec(d.oG);let e=new Map;function f(a){let b=e.get(a);return b||(b=c.prepare(a),e.set(a,b)),b}let g=setInterval(()=>{try{c.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},6e4);function h(){try{c.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}try{e.clear()}catch{}try{c.close()}catch{}}"function"==typeof g.unref&&g.unref();let i=()=>h();return process.once("beforeExit",i),process.once("SIGINT",()=>{i(),process.exit(0)}),process.once("SIGTERM",()=>{i(),process.exit(0)}),{driver:"bun:sqlite",run(a,b=[]){let c=f(a).run(...b);return{changes:Number(c.changes??0),lastInsertRowid:Number(c.lastInsertRowid??0)}},get:(a,b=[])=>f(a).get(...b),all:(a,b=[])=>f(a).all(...b),exec:a=>c.exec(a),transaction:a=>c.transaction(a)(),checkpoint(){try{c.exec("PRAGMA wal_checkpoint(TRUNCATE)")}catch{}},close(){clearInterval(g),h()},raw:c}}},78785:(a,b,c)=>{c.d(b,{CG:()=>f,f$:()=>d,oG:()=>e,zE:()=>g});let d=2,e=`
2
2
  PRAGMA journal_mode = WAL;
3
3
  PRAGMA synchronous = NORMAL;
4
4
  PRAGMA temp_store = MEMORY;
@@ -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
- `,f={_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",apiKeyName:"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",apiKey:"TEXT",apiKeyName:"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 g(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
+ `,f={_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",apiKeyName:"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",apiKey:"TEXT",apiKeyName:"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)"]},cachedProviderModels:{columns:{providerId:"TEXT NOT NULL",modelId:"TEXT NOT NULL",kind:"TEXT DEFAULT 'llm'",ownedBy:"TEXT NOT NULL",capabilities:"TEXT",updatedAt:"INTEGER NOT NULL"},primaryKey:"PRIMARY KEY (providerId, modelId)",indexes:["CREATE INDEX IF NOT EXISTS idx_cpm_kind ON cachedProviderModels(kind)","CREATE INDEX IF NOT EXISTS idx_cpm_provider ON cachedProviderModels(providerId)"]}};function g(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(", ")})`}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=3539,exports.ids=[3539,6820],exports.modules={8188:(a,b,c)=>{c.d(b,{B:()=>f,T:()=>h});var d=c(46820);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}}}function g(a){let b=5381;for(let c=0;c<a.length;c++)b=(b<<5)+b+a.charCodeAt(c),b&=b;return Math.abs(b).toString(36)}function h(a={}){let b=a?.connectionProxyEnabled===!0?e(a?.connectionProxyUrl):"";if(b)return`proxy-${g(b)}`;let c=e(a?.proxyPoolId);return c?`pool-${g(c)}`:"direct"}},46820:(a,b,c)=>{c.d(b,{Fh:()=>d.Fh,L9:()=>d.L9,Mc:()=>d.Mc,OM:()=>d.OM,P:()=>d.getProviderConnections,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,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(94164)},72238:(a,b,c)=>{c.d(b,{Ou:()=>i,eG:()=>h});var d=c(22830);let e=new Map,f=new Map,g=null;async function h(a,b){if(!a||!b)return null;let c=e.get(a);if(c&&Date.now()-c.fetchedAt<36e5)return c.projectId;if(f.has(a))return f.get(a).promise;let d=new AbortController,g=(async()=>{try{let c=await j(b,d.signal);if(c)return e.set(a,{projectId:c,fetchedAt:Date.now()}),c;return console.warn("[ProjectId] could not fetch projectId for connection",a.slice(0,8)),null}catch(a){return console.warn(`[ProjectId] Error fetching project ID: ${a.message}`),null}finally{f.delete(a)}})();return f.set(a,{promise:g,controller:d,startedAt:Date.now()}),g}function i(a){e.delete(a)}async function j(a,b){let c=await fetch(d.nZ.loadCodeAssist,{method:"POST",headers:{...d.Ic,Authorization:`Bearer ${a}`},body:JSON.stringify({metadata:d.zv}),signal:b});if(!c.ok){let a=await c.text().catch(()=>"");throw Error(`loadCodeAssist failed: HTTP ${c.status} ${a.slice(0,200)}`)}let e=await c.json(),f=function(a){if(!a)return null;if("string"==typeof a.cloudaicompanionProject){let b=a.cloudaicompanionProject.trim();if(b)return b}if(a.cloudaicompanionProject&&"object"==typeof a.cloudaicompanionProject){let b=a.cloudaicompanionProject.id;if("string"==typeof b&&b.trim())return b.trim()}return null}(e);if(f)return f;let g="legacy-tier";if(Array.isArray(e.allowedTiers)){for(let a of e.allowedTiers)if(a&&"object"==typeof a&&!0===a.isDefault&&a.id&&"string"==typeof a.id&&a.id.trim()){g=a.id.trim();break}}return k(a,g,b)}async function k(a,b,c){console.log(`[ProjectId] Onboarding user with tier: ${b}`);let e={tierId:b,metadata:d.zv};for(let b=1;b<=5&&!c?.aborted;b++){let f=new AbortController,g=setTimeout(()=>f.abort(),3e4),h=()=>f.abort();c?.addEventListener("abort",h);try{let c=await fetch(d.nZ.onboardUser,{method:"POST",headers:{...d.Ic,Authorization:`Bearer ${a}`},body:JSON.stringify(e),signal:f.signal});if(clearTimeout(g),!c.ok){let a=await c.text().catch(()=>"");throw Error(`onboardUser HTTP ${c.status}: ${a.slice(0,200)}`)}let h=await c.json();if(!0===h.done){let a=function(a){if(!a?.response)return null;let b=a.response.cloudaicompanionProject;if("string"==typeof b){let a=b.trim();if(a)return a}if(b&&"object"==typeof b){let a=b.id;if("string"==typeof a&&a.trim())return a.trim()}return null}(h);if(a)return console.log(`[ProjectId] Successfully onboarded, project ID: ${a}`),a;throw Error("onboardUser done but no project_id in response")}console.log(`[ProjectId] Onboard attempt ${b}/5: not done yet, waiting...`),await new Promise(a=>setTimeout(a,2e3))}catch(a){if(clearTimeout(g),"AbortError"===a.name){if(console.warn(`[ProjectId] onboardUser attempt ${b} aborted (timeout or connection removed)`),c?.aborted)return null;continue}if(5===b)return console.warn(`[ProjectId] onboardUser failed after 5 attempts: ${a.message}`),null;console.warn(`[ProjectId] onboardUser attempt ${b} failed: ${a.message}, retrying...`),await new Promise(a=>setTimeout(a,2e3))}finally{clearTimeout(g),c?.removeEventListener("abort",h)}}return null}g=setInterval(()=>{try{let a=Date.now();for(let[b,c]of e)(!c||a-c.fetchedAt>=36e5)&&e.delete(b);for(let[b,c]of f){if(!c||"number"!=typeof c.startedAt){f.delete(b);continue}if(a-c.startedAt>12e4){try{c.controller.abort()}catch(a){}f.delete(b)}}}catch(a){console.warn("[ProjectId] cleanup sweep error:",a?.message??a)}},6e5),g?.unref?.()},83950:(a,b,c)=>{c.d(b,{I9:()=>j,eU:()=>n,vN:()=>m});var d=c(90293),e=c(94164),f=c(72238),g=c(91392),h=c(28765);let i=g.oD,j=(a,b,c)=>(0,g.I9)(a,b,c,d);function k(a){return new Date(Date.now()+1e3*a).toISOString()}function l(a){if(!a)return null;let b=new Date(a);return Number.isFinite(b.getTime())?b.toISOString():null}async function m(a,b){try{let c={};if(b.accessToken&&(c.accessToken=b.accessToken),b.refreshToken&&(c.refreshToken=b.refreshToken),b.idToken&&(c.idToken=b.idToken),b.lastRefreshAt&&(c.lastRefreshAt=b.lastRefreshAt),b.expiresAt&&(c.expiresAt=b.expiresAt),b.expiresIn)c.expiresAt=k(b.expiresIn),c.expiresIn=b.expiresIn;else if(b.expiresAt){let a=l(b.expiresAt);a&&(c.expiresAt=a,c.expiresIn=Math.max(1,Math.floor((new Date(a).getTime()-Date.now())/1e3)))}b.providerSpecificData&&(c.providerSpecificData={...b.existingProviderSpecificData||{},...b.providerSpecificData}),(b.copilotToken||b.copilotTokenExpiresAt)&&(c.providerSpecificData={...c.providerSpecificData||b.existingProviderSpecificData||{},...b.copilotToken?{copilotToken:b.copilotToken}:{},...b.copilotTokenExpiresAt?{copilotTokenExpiresAt:b.copilotTokenExpiresAt}:{}}),b.projectId&&(c.projectId=b.projectId);let f=await (0,e.updateProviderConnection)(a,c);return d.info("TOKEN_REFRESH","Credentials updated in localDb",{connectionId:a,success:!!f}),!!f}catch(b){return d.error("TOKEN_REFRESH","Error updating credentials in localDb",{connectionId:a,error:b.message}),!1}}async function n(a,b){let c={...b};if(!c.connectionId&&c.id&&(c.connectionId=c.id),(0,h.fp)(a,c)){let b=c.expiresAt?new Date(c.expiresAt).getTime():null,e=b?b-Date.now():null,i=(0,g.Og)(a);d.info("TOKEN_REFRESH","Refreshing provider credentials proactively",{provider:a,expiresIn:null===e?null:Math.round(e/1e3),refreshLeadMs:i,lastRefreshAt:c.lastRefreshAt||null});let j=await (0,h.Vq)(a,c,d);if(j?.accessToken||j?.apiKey||j?.copilotToken){let b={...j,existingProviderSpecificData:c.providerSpecificData};await m(c.connectionId,b),function(a,b,c){if("antigravity"!==a&&"gemini-cli"!==a||!b||!b.connectionId||!c||b.isProjectIdManual)return;let e=b.connectionId;(0,f.Ou)(e),(0,f.eG)(e,c).then(a=>{a&&m(e,{projectId:a}).catch(a=>{d.debug("TOKEN_REFRESH","Failed to persist refreshed projectId",{connectionId:e,error:a?.message??a})})}).catch(a=>{d.debug("TOKEN_REFRESH","Failed to fetch projectId after token refresh",{connectionId:e,error:a?.message??a})})}(a,c={...c,...j,expiresAt:j.expiresIn?k(j.expiresIn):l(j.expiresAt)||j.expiresAt||c.expiresAt,providerSpecificData:j.providerSpecificData?{...c.providerSpecificData,...j.providerSpecificData}:c.providerSpecificData},c.accessToken)}}if("github"===a){let b=c.providerSpecificData?.copilotToken,e=(c.providerSpecificData?.copilotTokenExpiresAt?1e3*c.providerSpecificData.copilotTokenExpiresAt:0)-Date.now();if(!b||e<i){let f;d.info("TOKEN_REFRESH","Copilot token expiring soon or missing, refreshing proactively",{provider:a,expiresIn:b?Math.round(e/1e3):"missing"});let h=await (f=c.accessToken,(0,g.jR)(f,d));if(h){let a={...c.providerSpecificData,copilotToken:h.token,copilotTokenExpiresAt:h.expiresAt};await m(c.connectionId,{providerSpecificData:a}),c.providerSpecificData=a,c.copilotToken=h.token}}}return c}},90293:(a,b,c)=>{c.r(b),c.d(b,{debug:()=>o,error:()=>r,errorLine:()=>l,fmtThink:()=>m,info:()=>p,line:()=>k,maskKey:()=>v,nextTag:()=>i,request:()=>s,response:()=>t,stream:()=>u,tagForSession:()=>j,warn:()=>q});let d={DEBUG:0,INFO:1,WARN:2,ERROR:3},e=d[process.env.LOG_LEVEL?.toUpperCase?.()]??d.INFO;function f(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}let g=["\uD83D\uDFE2","\uD83D\uDD35","\uD83D\uDFE3","\uD83D\uDFE1","\uD83D\uDFE0","\uD83D\uDD34","âšĒ","\uD83D\uDFE4"],h=0;function i(){let a=g[h%g.length];return h++,a}function j(a){if(!a)return i();let b=0;for(let c=0;c<a.length;c++)b=31*b+a.charCodeAt(c)|0;return g[Math.abs(b)%g.length]}function k(a,b,c){e>d.INFO||console.log(`[${f()}] ${a} ${b} ${c}`)}function l(a,b,c){console.log(`[${f()}] ${a} ${b} ${c}`)}function m(a){return a&&a.mode?"none"===a.mode?"off":"auto"===a.mode?"auto":"budget"===a.mode?a.budget>=1e3?`${Math.round(a.budget/1e3)}k`:`${a.budget}`:"level"===a.mode?a.level:null:null}function n(a){if(!a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function o(a,b,c){if(e<=d.DEBUG){let d=c?` ${n(c)}`:"";console.log(`[${f()}] 🔍 [${a}] ${b}${d}`)}}function p(a,b,c){if(e<=d.INFO){let d=c?` ${n(c)}`:"";console.log(`[${f()}] â„šī¸ [${a}] ${b}${d}`)}}function q(a,b,c){if(e<=d.WARN){let d=c?` ${n(c)}`:"";console.warn(`[${f()}] âš ī¸ [${a}] ${b}${d}`)}}function r(a,b,c){if(e<=d.ERROR){let d=c?` ${n(c)}`:"";console.log(`[${f()}] ❌ [${a}] ${b}${d}`)}}function s(a,b,c){let d=c?` ${n(c)}`:"";console.log(`\x1b[36m[${f()}] đŸ“Ĩ ${a} ${b}${d}\x1b[0m`)}function t(a,b,c){let d=c?` ${n(c)}`:"";console.log(`[${f()}] ${a<400?"\uD83D\uDCE4":"\uD83D\uDCA5"} ${a} (${b}ms)${d}`)}function u(a,b){let c=b?` ${n(b)}`:"";console.log(`[${f()}] 🌊 [STREAM] ${a}${c}`)}function v(a){return!a||a.length<8?"***":`${a.slice(0,4)}...${a.slice(-4)}`}},94164:(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,XH:()=>d.XH,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,wA:()=>d.wA,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(77725)}};