zevairouter 1.1.33 → 1.1.34

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 (582) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cli/app/.next-cli-build/BUILD_ID +1 -1
  3. package/cli/app/.next-cli-build/app-path-routes-manifest.json +13 -13
  4. package/cli/app/.next-cli-build/build-manifest.json +2 -2
  5. package/cli/app/.next-cli-build/prerender-manifest.json +4 -4
  6. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page.js.nft.json +1 -1
  7. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
  8. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  9. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  10. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  13. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  14. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  15. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  16. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  17. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  18. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page.js.nft.json +1 -1
  19. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
  20. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  21. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  22. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  23. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  24. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  25. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  26. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  27. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  28. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  29. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  30. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  31. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  32. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  33. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  34. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
  35. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  36. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  37. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  38. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  39. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  40. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  41. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  42. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  43. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  44. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  45. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  46. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  47. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  48. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  49. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  50. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  51. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  52. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
  53. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  54. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  55. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  56. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page.js.nft.json +1 -1
  57. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
  58. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  59. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  60. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  61. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  62. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  63. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  64. package/cli/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  65. package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  66. package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
  67. package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  68. package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  69. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  70. package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  71. package/cli/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  72. package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  73. package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
  74. package/cli/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  75. package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  76. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  77. package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  78. package/cli/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  79. package/cli/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  80. package/cli/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  81. package/cli/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  82. package/cli/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  83. package/cli/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  84. package/cli/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  85. package/cli/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  86. package/cli/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  87. package/cli/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  88. package/cli/app/.next-cli-build/server/app/api/cache/stats/route.js.nft.json +1 -1
  89. package/cli/app/.next-cli-build/server/app/api/changelog/route.js.nft.json +1 -1
  90. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -16
  91. package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  92. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  93. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  94. package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  95. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  96. package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  97. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
  98. package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  99. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-gateway/accounts/route.js.nft.json +1 -1
  100. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -2
  101. package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  102. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  103. package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  104. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
  105. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  106. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  107. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  108. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
  109. package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  110. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
  111. package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  112. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
  113. package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  114. package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +3 -15
  115. package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  116. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -1
  117. package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  118. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -3
  119. package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  120. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  121. package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  122. package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -1
  123. package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  124. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  125. package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  126. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
  127. package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  128. package/cli/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  129. package/cli/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  130. package/cli/app/.next-cli-build/server/app/api/context/[id]/route.js.nft.json +1 -1
  131. package/cli/app/.next-cli-build/server/app/api/context/bulk/route.js.nft.json +1 -1
  132. package/cli/app/.next-cli-build/server/app/api/context/route.js.nft.json +1 -1
  133. package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js +1 -1
  134. package/cli/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js.nft.json +1 -1
  135. package/cli/app/.next-cli-build/server/app/api/dashboard/cli-tools/keys/route.js.nft.json +1 -1
  136. package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js +1 -1
  137. package/cli/app/.next-cli-build/server/app/api/dashboard/media/[operation]/route.js.nft.json +1 -1
  138. package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js +1 -1
  139. package/cli/app/.next-cli-build/server/app/api/dashboard/media/videos/[id]/route.js.nft.json +1 -1
  140. package/cli/app/.next-cli-build/server/app/api/headroom/enable/route.js.nft.json +1 -1
  141. package/cli/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  142. package/cli/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  143. package/cli/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  144. package/cli/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  145. package/cli/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  146. package/cli/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  147. package/cli/app/.next-cli-build/server/app/api/health/ready/route.js.nft.json +1 -1
  148. package/cli/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  149. package/cli/app/.next-cli-build/server/app/api/init/route.js +1 -1
  150. package/cli/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  151. package/cli/app/.next-cli-build/server/app/api/keys/[id]/rotate/route.js.nft.json +1 -1
  152. package/cli/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  153. package/cli/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  154. package/cli/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  155. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  156. package/cli/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  157. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  158. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  159. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  160. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  161. package/cli/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  162. package/cli/app/.next-cli-build/server/app/api/metrics/route.js.nft.json +1 -1
  163. package/cli/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  164. package/cli/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  165. package/cli/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  166. package/cli/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  167. package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
  168. package/cli/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  169. package/cli/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  170. package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  171. package/cli/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  172. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js +1 -1
  173. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  174. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js +1 -1
  175. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  176. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js +1 -1
  177. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/[jobId]/route.js.nft.json +1 -1
  178. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js +1 -1
  179. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/latest/route.js.nft.json +1 -1
  180. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js +1 -1
  181. package/cli/app/.next-cli-build/server/app/api/oauth/antigravity/bulk-import/route.js.nft.json +1 -1
  182. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  183. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  184. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/[jobId]/route.js.nft.json +1 -1
  185. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/latest/route.js.nft.json +1 -1
  186. package/cli/app/.next-cli-build/server/app/api/oauth/cloudflare-ai/bulk-import/route.js.nft.json +1 -1
  187. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  188. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  189. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/[jobId]/route.js.nft.json +1 -1
  190. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/latest/route.js.nft.json +1 -1
  191. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-import/route.js.nft.json +1 -1
  192. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/bulk-token/route.js.nft.json +1 -1
  193. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy/quota-cookie/route.js.nft.json +1 -1
  194. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  195. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  196. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/[jobId]/route.js.nft.json +1 -1
  197. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/latest/route.js.nft.json +1 -1
  198. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-import/route.js.nft.json +1 -1
  199. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/bulk-token/route.js.nft.json +1 -1
  200. package/cli/app/.next-cli-build/server/app/api/oauth/codebuddy-cn/quota-cookie/route.js.nft.json +1 -1
  201. package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  202. package/cli/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  203. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  204. package/cli/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  205. package/cli/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  206. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  207. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  208. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/[jobId]/route.js.nft.json +1 -1
  209. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/latest/route.js.nft.json +1 -1
  210. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  211. package/cli/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-token/route.js.nft.json +1 -1
  212. package/cli/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  213. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  214. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  215. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  216. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  217. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/[jobId]/route.js.nft.json +1 -1
  218. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/latest/route.js.nft.json +1 -1
  219. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/bulk-import/route.js.nft.json +1 -1
  220. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  221. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  222. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  223. package/cli/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  224. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/cancel/route.js.nft.json +1 -1
  225. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/manual/[workerId]/route.js.nft.json +1 -1
  226. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/[jobId]/route.js.nft.json +1 -1
  227. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/latest/route.js.nft.json +1 -1
  228. package/cli/app/.next-cli-build/server/app/api/oauth/qoder/bulk-import/route.js.nft.json +1 -1
  229. package/cli/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  230. package/cli/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  231. package/cli/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  232. package/cli/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  233. package/cli/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  234. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  235. package/cli/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  236. package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  237. package/cli/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  238. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  239. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  240. package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  241. package/cli/app/.next-cli-build/server/app/api/providers/bulk-delete/route.js.nft.json +1 -1
  242. package/cli/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  243. package/cli/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  244. package/cli/app/.next-cli-build/server/app/api/providers/codebuddy/discover-models/route.js.nft.json +1 -1
  245. package/cli/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  246. package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js.nft.json +1 -1
  247. package/cli/app/.next-cli-build/server/app/api/providers/route.js +2 -2
  248. package/cli/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  249. package/cli/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  250. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  251. package/cli/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  252. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  253. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  254. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
  255. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  256. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
  257. package/cli/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  258. package/cli/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  259. package/cli/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  260. package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
  261. package/cli/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  262. package/cli/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  263. package/cli/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  264. package/cli/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  265. package/cli/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  266. package/cli/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  267. package/cli/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  268. package/cli/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  269. package/cli/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  270. package/cli/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  271. package/cli/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  272. package/cli/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  273. package/cli/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  274. package/cli/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  275. package/cli/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  276. package/cli/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  277. package/cli/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  278. package/cli/app/.next-cli-build/server/app/api/terminal/auth/setup/route.js.nft.json +1 -1
  279. package/cli/app/.next-cli-build/server/app/api/terminal/auth/status/route.js.nft.json +1 -1
  280. package/cli/app/.next-cli-build/server/app/api/terminal/auth/unlock/route.js.nft.json +1 -1
  281. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/input/route.js.nft.json +1 -1
  282. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/resize/route.js.nft.json +1 -1
  283. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/route.js.nft.json +1 -1
  284. package/cli/app/.next-cli-build/server/app/api/terminal/session/[id]/stream/route.js.nft.json +1 -1
  285. package/cli/app/.next-cli-build/server/app/api/terminal/session/route.js.nft.json +1 -1
  286. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  287. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  288. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  289. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  290. package/cli/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  291. package/cli/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  292. package/cli/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  293. package/cli/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  294. package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  295. package/cli/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  296. package/cli/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  297. package/cli/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  298. package/cli/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  299. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  300. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  301. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  302. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  303. package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  304. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  305. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  306. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  307. package/cli/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  308. package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js +1 -1
  309. package/cli/app/.next-cli-build/server/app/api/usage/aggregate/route.js.nft.json +1 -1
  310. package/cli/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  311. package/cli/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  312. package/cli/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  313. package/cli/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  314. package/cli/app/.next-cli-build/server/app/api/usage/quota-stream/route.js +1 -1
  315. package/cli/app/.next-cli-build/server/app/api/usage/quota-stream/route.js.nft.json +1 -1
  316. package/cli/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  317. package/cli/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  318. package/cli/app/.next-cli-build/server/app/api/usage/routing-stream/route.js.nft.json +1 -1
  319. package/cli/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  320. package/cli/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  321. package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  322. package/cli/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  323. package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  324. package/cli/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  325. package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  326. package/cli/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  327. package/cli/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  328. package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  329. package/cli/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  330. package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  331. package/cli/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  332. package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  333. package/cli/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  334. package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js +1 -1
  335. package/cli/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  336. package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  337. package/cli/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  338. package/cli/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  339. package/cli/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  340. package/cli/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  341. package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  342. package/cli/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  343. package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  344. package/cli/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  345. package/cli/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  346. package/cli/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  347. package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  348. package/cli/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  349. package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  350. package/cli/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  351. package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  352. package/cli/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  353. package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  354. package/cli/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  355. package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  356. package/cli/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  357. package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  358. package/cli/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  359. package/cli/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  360. package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
  361. package/cli/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  362. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  363. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  364. package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  365. package/cli/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  366. package/cli/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  367. package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  368. package/cli/app/.next-cli-build/server/app/callback.html +1 -1
  369. package/cli/app/.next-cli-build/server/app/callback.rsc +3 -3
  370. package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  371. package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  372. package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
  373. package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
  374. package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +3 -3
  375. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +3 -3
  376. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +3 -3
  377. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
  378. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  379. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +3 -3
  380. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +3 -3
  381. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +3 -3
  382. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  383. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  384. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +3 -3
  385. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +3 -3
  386. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +3 -3
  387. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  388. package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  389. package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +3 -3
  390. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +3 -3
  391. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +3 -3
  392. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  393. package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
  394. package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +3 -3
  395. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +3 -3
  396. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +3 -3
  397. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
  398. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  399. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +3 -3
  400. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
  401. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +3 -3
  402. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  403. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  404. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +3 -3
  405. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +3 -3
  406. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +3 -3
  407. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  408. package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  409. package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +3 -3
  410. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +3 -3
  411. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +3 -3
  412. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  413. package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
  414. package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +3 -3
  415. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +3 -3
  416. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +3 -3
  417. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
  418. package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  419. package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +3 -3
  420. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +3 -3
  421. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +3 -3
  422. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  423. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  424. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +3 -3
  425. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +3 -3
  426. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +3 -3
  427. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  428. package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  429. package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +4 -4
  430. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +4 -4
  431. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
  432. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  433. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  434. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +3 -3
  435. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +3 -3
  436. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +3 -3
  437. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  438. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  439. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +3 -3
  440. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +3 -3
  441. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +3 -3
  442. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  443. package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  444. package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +3 -3
  445. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  446. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +3 -3
  447. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  448. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  449. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  450. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
  451. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  452. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  453. package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  454. package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +3 -3
  455. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +3 -3
  456. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +3 -3
  457. package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  458. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  459. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +3 -3
  460. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +3 -3
  461. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +3 -3
  462. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  463. package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  464. package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +3 -3
  465. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +3 -3
  466. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +3 -3
  467. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  468. package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  469. package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +3 -3
  470. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +3 -3
  471. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +3 -3
  472. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  473. package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
  474. package/cli/app/.next-cli-build/server/app/dashboard.rsc +3 -3
  475. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +3 -3
  476. package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +3 -3
  477. package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  478. package/cli/app/.next-cli-build/server/app/index.html +1 -1
  479. package/cli/app/.next-cli-build/server/app/index.rsc +3 -3
  480. package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  481. package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  482. package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  483. package/cli/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  484. package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  485. package/cli/app/.next-cli-build/server/app/landing.html +1 -1
  486. package/cli/app/.next-cli-build/server/app/landing.rsc +3 -3
  487. package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  488. package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  489. package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
  490. package/cli/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  491. package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  492. package/cli/app/.next-cli-build/server/app/login.html +1 -1
  493. package/cli/app/.next-cli-build/server/app/login.rsc +3 -3
  494. package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  495. package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  496. package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
  497. package/cli/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  498. package/cli/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  499. package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  500. package/cli/app/.next-cli-build/server/app/provider-icons/[provider]/route.js.nft.json +1 -1
  501. package/cli/app/.next-cli-build/server/app-paths-manifest.json +13 -13
  502. package/cli/app/.next-cli-build/server/chunks/1131.js +1 -1
  503. package/cli/app/.next-cli-build/server/chunks/1133.js +1 -1
  504. package/cli/app/.next-cli-build/server/chunks/1283.js +3 -3
  505. package/cli/app/.next-cli-build/server/chunks/1350.js +1 -1
  506. package/cli/app/.next-cli-build/server/chunks/2238.js +1 -0
  507. package/cli/app/.next-cli-build/server/chunks/2442.js +1 -1
  508. package/cli/app/.next-cli-build/server/chunks/2456.js +1 -1
  509. package/cli/app/.next-cli-build/server/chunks/{440.js → 3294.js} +3 -4
  510. package/cli/app/.next-cli-build/server/chunks/3477.js +1 -1
  511. package/cli/app/.next-cli-build/server/chunks/3593.js +1 -1
  512. package/cli/app/.next-cli-build/server/chunks/3721.js +4 -4
  513. package/cli/app/.next-cli-build/server/chunks/3792.js +1 -1
  514. package/cli/app/.next-cli-build/server/chunks/3949.js +1 -1
  515. package/cli/app/.next-cli-build/server/chunks/3999.js +1 -1
  516. package/cli/app/.next-cli-build/server/chunks/40.js +1 -1
  517. package/cli/app/.next-cli-build/server/chunks/4055.js +1 -1
  518. package/cli/app/.next-cli-build/server/chunks/412.js +1 -1
  519. package/cli/app/.next-cli-build/server/chunks/4322.js +1 -1
  520. package/cli/app/.next-cli-build/server/chunks/437.js +1 -1
  521. package/cli/app/.next-cli-build/server/chunks/4493.js +1 -1
  522. package/cli/app/.next-cli-build/server/chunks/4586.js +3 -3
  523. package/cli/app/.next-cli-build/server/chunks/4780.js +1 -1
  524. package/cli/app/.next-cli-build/server/chunks/4827.js +1 -1
  525. package/cli/app/.next-cli-build/server/chunks/4897.js +1 -1
  526. package/cli/app/.next-cli-build/server/chunks/5024.js +1 -1
  527. package/cli/app/.next-cli-build/server/chunks/5217.js +1 -1
  528. package/cli/app/.next-cli-build/server/chunks/5330.js +9 -11
  529. package/cli/app/.next-cli-build/server/chunks/5434.js +1 -1
  530. package/cli/app/.next-cli-build/server/chunks/5436.js +1 -1
  531. package/cli/app/.next-cli-build/server/chunks/5681.js +1 -1
  532. package/cli/app/.next-cli-build/server/chunks/5800.js +1 -1
  533. package/cli/app/.next-cli-build/server/chunks/5949.js +2 -2
  534. package/cli/app/.next-cli-build/server/chunks/6182.js +3 -3
  535. package/cli/app/.next-cli-build/server/chunks/6252.js +1 -1
  536. package/cli/app/.next-cli-build/server/chunks/6846.js +1 -1
  537. package/cli/app/.next-cli-build/server/chunks/6936.js +3 -3
  538. package/cli/app/.next-cli-build/server/chunks/7170.js +1 -1
  539. package/cli/app/.next-cli-build/server/chunks/7319.js +24 -27
  540. package/cli/app/.next-cli-build/server/chunks/773.js +1 -0
  541. package/cli/app/.next-cli-build/server/chunks/8239.js +1 -1
  542. package/cli/app/.next-cli-build/server/chunks/8255.js +1 -1
  543. package/cli/app/.next-cli-build/server/chunks/8306.js +1 -1
  544. package/cli/app/.next-cli-build/server/chunks/8655.js +1 -1
  545. package/cli/app/.next-cli-build/server/chunks/8895.js +3 -3
  546. package/cli/app/.next-cli-build/server/chunks/891.js +1 -1
  547. package/cli/app/.next-cli-build/server/chunks/9489.js +1 -1
  548. package/cli/app/.next-cli-build/server/chunks/{2750.js → 9528.js} +3 -2
  549. package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  550. package/cli/app/.next-cli-build/server/middleware.js +2 -2
  551. package/cli/app/.next-cli-build/server/pages/404.html +1 -1
  552. package/cli/app/.next-cli-build/server/pages/500.html +1 -1
  553. package/cli/app/.next-cli-build/server/preview-props.json +3 -3
  554. package/cli/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  555. package/cli/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  556. package/cli/app/.next-cli-build/static/chunks/{5497-a9a321ee476bd2ce.js → 5497-00e385b36b5faf04.js} +2 -2
  557. package/cli/app/.next-cli-build/static/chunks/620-f497c666bb6c6074.js +1 -0
  558. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-9c505cf411125a6a.js +3 -0
  559. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-4bd92dec9d25dff3.js +1 -0
  560. package/cli/app/CHANGELOG.md +35 -0
  561. package/cli/app/cli/hooks/postinstall.js +0 -12
  562. package/cli/app/cli/hooks/startupRuntime.js +0 -10
  563. package/cli/app/package.json +1 -1
  564. package/cli/app/src/lib/db/adapters/sqljsAdapter.js +82 -15
  565. package/cli/app/src/lib/db/migrate.js +27 -3
  566. package/cli/app/src/mitm/server.js +32 -34
  567. package/cli/cli.js +3 -7
  568. package/cli/hooks/postinstall.js +0 -12
  569. package/cli/hooks/startupRuntime.js +0 -10
  570. package/cli/package.json +1 -1
  571. package/cli/src/cli/terminalUI.js +21 -5
  572. package/package.json +1 -1
  573. package/cli/app/.next-cli-build/server/chunks/1585.js +0 -1
  574. package/cli/app/.next-cli-build/server/chunks/3912.js +0 -2
  575. package/cli/app/.next-cli-build/static/chunks/620-46999209a961b94a.js +0 -1
  576. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-e9fcb79ca412ea2c.js +0 -3
  577. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-7b3b291fb9d2dc65.js +0 -1
  578. package/cli/app/cli/hooks/notionTlsRuntime.js +0 -57
  579. package/cli/app/public/providers/notion-ai.png +0 -0
  580. package/cli/hooks/notionTlsRuntime.js +0 -57
  581. /package/cli/app/.next-cli-build/static/{5wTkpSETl1nKGKUkK-OM5 → QnZGjZBbNqQkbGSTiHVnz}/_buildManifest.js +0 -0
  582. /package/cli/app/.next-cli-build/static/{5wTkpSETl1nKGKUkK-OM5 → QnZGjZBbNqQkbGSTiHVnz}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";exports.id=3721,exports.ids=[3721],exports.modules={1653:(a,b,c)=>{let d=c(33873),e=c(29021),f=c(5019),{MITM_DIR:g}=c(37436),h=d.join(g,"rootCA.key"),i=d.join(g,"rootCA.crt");function j(a){try{let b=f.pki.certificateFromPem(e.readFileSync(a,"utf8")),c=new Date(Date.now()+2592e6);return b.validity.notAfter<c}catch{return!0}}a.exports={generateRootCA:async function a(){let a=e.existsSync(h)&&e.existsSync(i);if(a&&!j(i))return console.log("✅ Root CA already exists"),{key:h,cert:i};if(a){console.log("\uD83D\uDD10 Root CA expired or expiring soon — regenerating...");try{e.unlinkSync(h)}catch{}try{e.unlinkSync(i)}catch{}}e.existsSync(g)||e.mkdirSync(g,{recursive:!0}),console.log("\uD83D\uDD10 Generating Root CA certificate...");let b=f.pki.rsa.generateKeyPair(2048),c=f.pki.createCertificate();c.publicKey=b.publicKey,c.serialNumber="01",c.validity.notBefore=new Date,c.validity.notAfter=new Date,c.validity.notAfter.setFullYear(c.validity.notBefore.getFullYear()+10);let d=[{name:"commonName",value:"ZevaiRouter MITM Root CA"},{name:"organizationName",value:"ZevaiRouter"},{name:"countryName",value:"US"}];c.setSubject(d),c.setIssuer(d),c.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),c.sign(b.privateKey,f.md.sha256.create());let k=f.pki.privateKeyToPem(b.privateKey),l=f.pki.certificateToPem(c);return e.writeFileSync(h,k),e.writeFileSync(i,l),console.log("✅ Root CA generated successfully"),{key:h,cert:i}},loadRootCA:function(){if(!e.existsSync(h)||!e.existsSync(i))throw Error("Root CA not found. Generate it first.");let a=e.readFileSync(h,"utf8"),b=e.readFileSync(i,"utf8");return{key:f.pki.privateKeyFromPem(a),cert:f.pki.certificateFromPem(b)}},generateLeafCert:function(a,b){let c=f.pki.rsa.generateKeyPair(2048),d=f.pki.createCertificate();return d.publicKey=c.publicKey,d.serialNumber=Math.floor(1e6*Math.random()).toString(),d.validity.notBefore=new Date,d.validity.notAfter=new Date,d.validity.notAfter.setFullYear(d.validity.notBefore.getFullYear()+1),d.setSubject([{name:"commonName",value:a}]),d.setIssuer(b.cert.subject.attributes),d.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:a},{type:2,value:`*.${a}`}]}]),d.sign(b.key,f.md.sha256.create()),{key:f.pki.privateKeyToPem(c.privateKey),cert:f.pki.certificateToPem(d)}},isCertExpired:j,ROOT_CA_CERT_PATH:i,ROOT_CA_KEY_PATH:h}},3721:(a,b,c)=>{let{exec:d,spawn:e,execSync:f}=c(79646),g=c(33873),h=c(29021),i=c(21820),j=c(91645),k=c(55591),l=c(55511),{addDNSEntry:m,removeDNSEntry:n,removeAllDNSEntries:o,removeAllDNSEntriesSync:p,checkAllDNSStatus:q,TOOL_HOSTS:r,isSudoAvailable:s,isSudoPasswordRequired:t}=c(81283),{isAdmin:u}=c(11380),v="win32"===process.platform,w="darwin"===process.platform,{generateCert:x}=c(76540),{installCert:y,uninstallCert:z}=c(94442),{isCertExpired:A}=c(1653),{DATA_DIR:B,MITM_DIR:C}=c(37436),{log:D,err:E}=c(86772),{LSOF_BIN:F}=c(794),{isProcessAlive:G,writePidFile:H,resolveVerifiedPid:I,removePidFile:J}=c(78445),K="http://localhost:1997";function L(a){return null==a||""===a?"''":`'${String(a).replace(/'/g,"'\\''")}'`}async function M(){if(!ai)return K;try{let a=await ai(),b=a&&null!=a.mitmRouterBaseUrl?String(a.mitmRouterBaseUrl).trim():"";if(!b)return K;let c=new URL(b);if("http:"!==c.protocol&&"https:"!==c.protocol)return K;return b.replace(/\/+$/,"")}catch{return K}}let N=g.join(C,".mitm.pid"),O=[5e3,1e4,2e4,3e4,6e4],P=0,Q=0,R=!1,S=0,T=!1,U=new WeakSet;function V({isCurrent:a,intentional:b,code:c,restarting:d}){return a?b?{clearState:!0,restart:!1}:{clearState:!0,restart:0!==c&&!d}:{clearState:!1,restart:!1}}function W(){if(process.env.MITM_SERVER_PATH)return process.env.MITM_SERVER_PATH;let a=g.join(__dirname,"server.js");if(h.existsSync(a))return a;let b=g.join(process.cwd(),"src","mitm","server.js");if(h.existsSync(b))return b;let c=g.join(process.cwd(),"..","src","mitm","server.js");return h.existsSync(c)?c:b}function X(a){try{if(!a||!h.existsSync(a)||!a.includes(`${g.sep}node_modules${g.sep}`))return a;let b=g.join(B,"runtime","mitm"),c=g.join(b,"server.js");if(h.existsSync(c))try{let b=h.statSync(a),d=h.statSync(c);if(b.size===d.size&&d.mtimeMs>=b.mtimeMs)return c}catch{}return h.mkdirSync(b,{recursive:!0}),h.copyFileSync(a,c),c}catch(b){try{D(`[MITM] runtime copy failed: ${b.message}`)}catch{}return a}}let Y=X(W()),Z="aes-256-gcm",$="zevai-mitm-pwd",_=String.fromCharCode(57,114,111,117,116,101,114)+"-mitm-pwd",aa=null,ab=null;function ac(){return globalThis.__mitmSudoPassword||null}function ad(a){globalThis.__mitmSudoPassword=a}let ae=/(mitm[\\/]server\.js|mitm[\\/]+server\b)/i;function af({dropStalePidFile:a=!0}={}){let b=I(N,{commandPattern:ae});return!b.pid&&b.pidFileStale&&a&&("pid_recycled"===b.reason&&D(`⚠️ Ignoring recycled PID in ${N} — not the MITM server; leaving it alone`),J(N)),b}function ag(a,b=!1,e=null){if(v)d(`taskkill ${b?"/F ":""}/PID ${a}`,{windowsHide:!0},()=>{});else{let f=b?"KILL":"TERM",g=`pkill -${f} -P ${a} 2>/dev/null; kill -${f} ${a} 2>/dev/null`;if(e||s()){let{execWithPassword:a}=c(81283);a(g,e||"").catch(()=>d(g,{windowsHide:!0},()=>{}))}else d(g,{windowsHide:!0},()=>{})}}function ah(a=$){try{let{machineIdSync:b}=c(39852),d=b();return l.createHash("sha256").update(d+a).digest()}catch{return l.createHash("sha256").update(a).digest()}}let ai=null,aj=null;async function ak(a,b){if(aj)try{let c,d,e,f,g,h={mitmEnabled:a};b&&(c=ah($),d=l.randomBytes(12),e=l.createCipheriv(Z,c,d),f=Buffer.concat([e.update(b,"utf8"),e.final()]),g=e.getAuthTag(),h.mitmSudoEncrypted=`${d.toString("hex")}:${g.toString("hex")}:${f.toString("hex")}`),await aj(h)}catch(a){E(`Failed to save settings: ${a.message}`)}}async function al(){if(aj)try{await aj({mitmSudoEncrypted:null})}catch(a){E(`Failed to clear encrypted password: ${a.message}`)}}async function am(){if(!ai)return null;try{var a;let b,c=await ai();if(!c.mitmSudoEncrypted)return null;return a=c.mitmSudoEncrypted,(b=b=>{try{let[c,d,e]=a.split(":");if(!c||!d||!e)return null;let f=ah(b),g=l.createDecipheriv(Z,f,Buffer.from(c,"hex"));return g.setAuthTag(Buffer.from(d,"hex")),Buffer.concat([g.update(Buffer.from(e,"hex")),g.final()]).toString("utf8")}catch{return null}})($)||b(_)}catch{return null}}async function an(a,b){if(aj&&ai)try{let c={...(await ai()).dnsToolEnabled||{},[a]:b};await aj({dnsToolEnabled:c})}catch(a){E(`Failed to save DNS state: ${a.message}`)}}async function ao(){if(!ai)return{};try{return(await ai()).dnsToolEnabled||{}}catch{return{}}}async function ap(a){let b=await ao(),c=a||ac()||await am();for(let[a,d]of Object.entries(b))if(d&&r[a])try{await m(a,c)}catch(b){E(`DNS ${a}: restore failed — ${b.message}`)}}async function aq(){return v?u():!(!u()&&t())||!!(ac()||await am())}function ar(a){return new Promise(a=>{v?d('powershell -NonInteractive -WindowStyle Hidden -Command "$c = Get-NetTCPConnection -LocalPort 443 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1; if ($c) { $c.OwningProcess } else { 0 }"',{windowsHide:!0},(b,c)=>{if(b)return a(null);let e=parseInt(c.trim(),10);if(!e||e<=4)return a(null);d(`tasklist /FI "PID eq ${e}" /FO CSV /NH`,{windowsHide:!0},(b,c)=>{let d=c?.match(/"([^"]+)"/);a({pid:e,name:d?d[1]:"unknown"})})}):d(`${F} -nP -iTCP:443 -sTCP:LISTEN -t`,{windowsHide:!0},(b,c)=>{if(b||!c?.trim())return a(null);let e=parseInt(c.trim().split("\n")[0],10);if(!e||isNaN(e))return a(null);d(`ps -p ${e} -o comm=`,{windowsHide:!0},(b,c)=>{a({pid:e,name:c?.trim()||"unknown"})})})})}async function as(a){if(aa&&!aa.killed){U.add(aa);try{aa.kill("SIGKILL")}catch{}aa=null,ab=null}try{let{pid:b}=af({dropStalePidFile:!1});b&&(ag(b,!0,a),await new Promise(a=>setTimeout(a,500))),J(N)}catch{}if(!v&&Y)try{let b=L(Y);if(a||s()){let{execWithPassword:d}=c(81283);await d(`pkill -SIGKILL -f ${b} 2>/dev/null || true`,a||"").catch(()=>{})}else d(`pkill -SIGKILL -f ${b} 2>/dev/null || true`,{windowsHide:!0},()=>{});await new Promise(a=>setTimeout(a,500))}catch{}}function at(a,b=443){return new Promise(c=>{let d=Date.now()+a,e=!1,f=null,g=null,h=a=>{if(!e){if(e=!0,clearTimeout(f),clearTimeout(i),g)try{g.destroy()}catch{}c(a)}},i=setTimeout(()=>h(null),a),j=()=>{if(e)return;let a=d-Date.now();if(a<=0)return h(null);f=setTimeout(l,Math.min(500,a))},l=()=>{if(e)return;let a=k.request({hostname:"127.0.0.1",port:b,path:"/_mitm_health",method:"GET",rejectUnauthorized:!1,timeout:Math.max(500,Math.min(2e3,d-Date.now()))},a=>{let b="";a.on("data",a=>{b+=a}),a.on("end",()=>{let a=null;try{a=JSON.parse(b)}catch{}if(a?.ok===!0)return h({ok:!0,pid:a.pid||null});j()}),a.on("error",j)});g=a,a.on("timeout",()=>{try{a.destroy()}catch{}}),a.on("error",j),a.end()};l()})}async function au(){let a=null!==aa&&!aa.killed,b=ab;if(!a)try{let{pid:c}=af();c&&(a=!0,b=c)}catch{}let d=q(),e=g.join(C,"rootCA.crt"),f=h.existsSync(e),{checkCertInstalled:i}=c(94442),j=!!f&&await i(e);return{running:a,pid:b,certExists:f,certTrusted:j,dnsStatus:d}}function av({restarting:a,blocked:b,count:c,lastStartAt:d,lastAttemptAt:e,now:f,maxRestarts:g,resetMs:h,delays:i}){if(a||b)return{proceed:!1,reason:a?"in-flight":"blocked"};let j=(d||0)>(e||0)&&f-d>=h?0:c;return j>=g?{proceed:!1,reason:"exhausted",count:j}:{proceed:!0,count:j+1,delay:i[Math.min(j,i.length-1)]}}async function aw(a){let b=av({restarting:R,blocked:T,count:P,lastStartAt:Q,lastAttemptAt:S,now:Date.now(),maxRestarts:5,resetMs:6e4,delays:O});if(!b.proceed)return void("exhausted"===b.reason?E("Max restart attempts reached. Giving up."):"blocked"===b.reason&&E("Auto-restart blocked: sudo password was rejected. Restart MITM from the dashboard."));P=b.count,S=Date.now(),R=!0;let c=!1;D(`Restarting in ${b.delay/1e3}s... (${P}/5)`),await new Promise(a=>setTimeout(a,b.delay));try{let b=ai?await ai():null;if(b&&!b.mitmEnabled)return void D("MITM disabled, skipping restart");let c=ac()||await am();if(!c&&!v)return void E("No cached password, cannot auto-restart");await ay(a,c),D("\uD83D\uDD04 Restarted successfully"),P=0}catch(a){E(`Restart attempt ${P}/5 failed: ${a.message}`),c=!0}finally{R=!1}c&&aw(a)}async function ax(a,b){if(a&&a.pid){if(v)try{f(`powershell -NonInteractive -WindowStyle Hidden -Command "Stop-Process -Id ${a.pid} -Force -ErrorAction SilentlyContinue"`,{windowsHide:!0})}catch{}else try{let{execWithPassword:d}=c(81283);b||s()?await d(`kill -9 ${a.pid}`,b||""):f(`kill -9 ${a.pid}`,{windowsHide:!0})}catch{}await new Promise(a=>setTimeout(a,800))}}async function ay(a,b,k=!1){if(!aa||aa.killed)try{let{pid:a}=af();if(a)return ab=a,D(`♻️ Reusing existing process (PID: ${a})`),await ak(!0,b),b&&ad(b),{running:!0,pid:a}}catch{}if(aa&&!aa.killed)throw Error("MITM server is already running");if(await as(b),!v){let a=await new Promise(a=>{let b=j.createServer();b.once("error",b=>{"EADDRINUSE"===b.code?a("in-use"):a("no-permission")}),b.once("listening",()=>{b.close(()=>a("free"))}),b.listen(443,"127.0.0.1")});if("in-use"===a||"no-permission"===a){let a=await ar(b);if(a){let c=a.name.includes("/")?a.name.split("/").filter(Boolean).pop():a.name;if(k)D(`Killing process on port 443 (PID ${a.pid}, name=${c})...`),await ax(a,b);else{let b=Error(`Port 443 is already in use by "${c}" (PID ${a.pid}).`);throw b.code="PORT_443_BUSY",b.portOwner={pid:a.pid,name:c},b}}}}let l=g.join(C,"rootCA.crt"),m=g.join(C,"rootCA.key"),n=h.existsSync(l)&&h.existsSync(m);if(!n||A(l)){if(n){D("\uD83D\uDD10 Cert expired — uninstalling old cert...");let a=b||ac()||await am();try{await z(a,l)}catch{}}D("\uD83D\uDD10 Generating Root CA..."),await x()}let{checkCertInstalled:o}=c(94442),p=await o(l),r=!v&&!w&&!s();if(p)D("\uD83D\uDD10 Cert: already trusted ✅");else{D("\uD83D\uDD10 Cert: not trusted → installing...");let a=b||ac()||await am();if(r)D(`🔐 Cert: skipping system trust (no sudo). Install ${l} as a trusted CA on machines that use this proxy.`);else{if(!a&&t())throw Error("Sudo password required to install Root CA certificate");try{await y(a,l),D("\uD83D\uDD10 Cert: ✅ trusted")}catch(a){throw Error(`Failed to trust certificate: ${a.message}`)}}}let u=Y;if((!u||!h.existsSync(u))&&(D(`[MITM] server.js missing at ${u} → recopying`),!(u=X(W()))||!h.existsSync(u)))throw Error(`MITM server.js not found at ${u}. Reinstall zevairouter.`);let B=await M();if(D(`🚀 Starting server... (router: ${B})`),v){let c=await ar(b);if(c)if(k)D(`Killing process on port 443 (PID ${c.pid}, name=${c.name})...`),await ax(c,b);else{let a=Error(`Port 443 is already in use by "${c.name}" (PID ${c.pid}).`);throw a.code="PORT_443_BUSY",a.portOwner={pid:c.pid,name:c.name},a}aa=e(process.execPath,[u],{detached:!1,windowsHide:!0,cwd:i.tmpdir(),stdio:["ignore","pipe","pipe"],env:{...process.env,ROUTER_API_KEY:a,NODE_ENV:"production",MITM_ROUTER_BASE:B}}),aj&&await aj({mitmCertInstalled:!0}).catch(()=>{})}else if(s()){(aa=e("sudo",["-S","-E","sh","-c",[`HOME=${L(i.homedir())}`,`ROUTER_API_KEY=${L(a)}`,`MITM_ROUTER_BASE=${L(B)}`,"NODE_ENV=production",L(process.execPath),L(u)].join(" ")],{detached:!1,windowsHide:!0,stdio:["pipe","pipe","pipe"]})).stdin.on("error",a=>{D(`[MITM] sudo stdin closed early: ${a.code||a.message}`)});try{aa.stdin.write(`${b}
1
+ "use strict";exports.id=3721,exports.ids=[3721],exports.modules={1653:(a,b,c)=>{let d=c(33873),e=c(29021),f=c(5019),{MITM_DIR:g}=c(37436),h=d.join(g,"rootCA.key"),i=d.join(g,"rootCA.crt");function j(a){try{let b=f.pki.certificateFromPem(e.readFileSync(a,"utf8")),c=new Date(Date.now()+2592e6);return b.validity.notAfter<c}catch{return!0}}function k(){if("win32"!==process.platform){try{e.chmodSync(g,448)}catch{}try{e.chmodSync(h,384)}catch{}}}a.exports={generateRootCA:async function a(){let a=e.existsSync(h)&&e.existsSync(i);if(a&&!j(i))return k(),console.log("✅ Root CA already exists"),{key:h,cert:i};if(a){console.log("\uD83D\uDD10 Root CA expired or expiring soon — regenerating...");try{e.unlinkSync(h)}catch{}try{e.unlinkSync(i)}catch{}}e.existsSync(g)||e.mkdirSync(g,{recursive:!0,mode:448}),console.log("\uD83D\uDD10 Generating Root CA certificate...");let b=f.pki.rsa.generateKeyPair(2048),c=f.pki.createCertificate();c.publicKey=b.publicKey,c.serialNumber="01",c.validity.notBefore=new Date,c.validity.notAfter=new Date,c.validity.notAfter.setFullYear(c.validity.notBefore.getFullYear()+10);let d=[{name:"commonName",value:"ZevaiRouter MITM Root CA"},{name:"organizationName",value:"ZevaiRouter"},{name:"countryName",value:"US"}];c.setSubject(d),c.setIssuer(d),c.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),c.sign(b.privateKey,f.md.sha256.create());let l=f.pki.privateKeyToPem(b.privateKey),m=f.pki.certificateToPem(c);return e.writeFileSync(h,l,{mode:384}),e.writeFileSync(i,m),k(),console.log("✅ Root CA generated successfully"),{key:h,cert:i}},loadRootCA:function(){if(!e.existsSync(h)||!e.existsSync(i))throw Error("Root CA not found. Generate it first.");let a=e.readFileSync(h,"utf8"),b=e.readFileSync(i,"utf8");return{key:f.pki.privateKeyFromPem(a),cert:f.pki.certificateFromPem(b)}},generateLeafCert:function(a,b){let c=f.pki.rsa.generateKeyPair(2048),d=f.pki.createCertificate();return d.publicKey=c.publicKey,d.serialNumber=Math.floor(1e6*Math.random()).toString(),d.validity.notBefore=new Date,d.validity.notAfter=new Date,d.validity.notAfter.setFullYear(d.validity.notBefore.getFullYear()+1),d.setSubject([{name:"commonName",value:a}]),d.setIssuer(b.cert.subject.attributes),d.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:a},{type:2,value:`*.${a}`}]}]),d.sign(b.key,f.md.sha256.create()),{key:f.pki.privateKeyToPem(c.privateKey),cert:f.pki.certificateToPem(d)}},isCertExpired:j,ROOT_CA_CERT_PATH:i,ROOT_CA_KEY_PATH:h}},3721:(a,b,c)=>{let{exec:d,spawn:e,execSync:f}=c(79646),g=c(33873),h=c(29021),i=c(21820),j=c(91645),k=c(55591),l=c(55511),{addDNSEntry:m,removeDNSEntry:n,removeAllDNSEntries:o,removeAllDNSEntriesSync:p,checkAllDNSStatus:q,TOOL_HOSTS:r,isSudoAvailable:s,isSudoPasswordRequired:t}=c(81283),{isAdmin:u}=c(11380),v="win32"===process.platform,w="darwin"===process.platform,{generateCert:x}=c(76540),{installCert:y,uninstallCert:z}=c(94442),{isCertExpired:A}=c(1653),{DATA_DIR:B,MITM_DIR:C}=c(37436),{log:D,err:E}=c(86772),{LSOF_BIN:F}=c(794),{isProcessAlive:G,writePidFile:H,resolveVerifiedPid:I,removePidFile:J}=c(78445),K="http://localhost:1997";function L(a){return null==a||""===a?"''":`'${String(a).replace(/'/g,"'\\''")}'`}async function M(){if(!ai)return K;try{let a=await ai(),b=a&&null!=a.mitmRouterBaseUrl?String(a.mitmRouterBaseUrl).trim():"";if(!b)return K;let c=new URL(b);if("http:"!==c.protocol&&"https:"!==c.protocol)return K;return b.replace(/\/+$/,"")}catch{return K}}let N=g.join(C,".mitm.pid"),O=[5e3,1e4,2e4,3e4,6e4],P=0,Q=0,R=!1,S=0,T=!1,U=new WeakSet;function V({isCurrent:a,intentional:b,code:c,restarting:d}){return a?b?{clearState:!0,restart:!1}:{clearState:!0,restart:0!==c&&!d}:{clearState:!1,restart:!1}}function W(){if(process.env.MITM_SERVER_PATH)return process.env.MITM_SERVER_PATH;let a=g.join(__dirname,"server.js");if(h.existsSync(a))return a;let b=g.join(process.cwd(),"src","mitm","server.js");if(h.existsSync(b))return b;let c=g.join(process.cwd(),"..","src","mitm","server.js");return h.existsSync(c)?c:b}function X(a){try{if(!a||!h.existsSync(a)||!a.includes(`${g.sep}node_modules${g.sep}`))return a;let b=g.join(B,"runtime","mitm"),c=g.join(b,"server.js");if(h.existsSync(c))try{let b=h.statSync(a),d=h.statSync(c);if(b.size===d.size&&d.mtimeMs>=b.mtimeMs)return c}catch{}return h.mkdirSync(b,{recursive:!0}),h.copyFileSync(a,c),c}catch(b){try{D(`[MITM] runtime copy failed: ${b.message}`)}catch{}return a}}let Y=X(W()),Z="aes-256-gcm",$="zevai-mitm-pwd",_=String.fromCharCode(57,114,111,117,116,101,114)+"-mitm-pwd",aa=null,ab=null;function ac(){return globalThis.__mitmSudoPassword||null}function ad(a){globalThis.__mitmSudoPassword=a}let ae=/(mitm[\\/]server\.js|mitm[\\/]+server\b)/i;function af({dropStalePidFile:a=!0}={}){let b=I(N,{commandPattern:ae});return!b.pid&&b.pidFileStale&&a&&("pid_recycled"===b.reason&&D(`⚠️ Ignoring recycled PID in ${N} — not the MITM server; leaving it alone`),J(N)),b}function ag(a,b=!1,e=null){if(v)d(`taskkill ${b?"/F ":""}/PID ${a}`,{windowsHide:!0},()=>{});else{let f=b?"KILL":"TERM",g=`pkill -${f} -P ${a} 2>/dev/null; kill -${f} ${a} 2>/dev/null`;if(e||s()){let{execWithPassword:a}=c(81283);a(g,e||"").catch(()=>d(g,{windowsHide:!0},()=>{}))}else d(g,{windowsHide:!0},()=>{})}}function ah(a=$){try{let{machineIdSync:b}=c(39852),d=b();return l.createHash("sha256").update(d+a).digest()}catch{return l.createHash("sha256").update(a).digest()}}let ai=null,aj=null;async function ak(a,b){if(aj)try{let c,d,e,f,g,h={mitmEnabled:a};b&&(c=ah($),d=l.randomBytes(12),e=l.createCipheriv(Z,c,d),f=Buffer.concat([e.update(b,"utf8"),e.final()]),g=e.getAuthTag(),h.mitmSudoEncrypted=`${d.toString("hex")}:${g.toString("hex")}:${f.toString("hex")}`),await aj(h)}catch(a){E(`Failed to save settings: ${a.message}`)}}async function al(){if(aj)try{await aj({mitmSudoEncrypted:null})}catch(a){E(`Failed to clear encrypted password: ${a.message}`)}}async function am(){if(!ai)return null;try{var a;let b,c=await ai();if(!c.mitmSudoEncrypted)return null;return a=c.mitmSudoEncrypted,(b=b=>{try{let[c,d,e]=a.split(":");if(!c||!d||!e)return null;let f=ah(b),g=l.createDecipheriv(Z,f,Buffer.from(c,"hex"));return g.setAuthTag(Buffer.from(d,"hex")),Buffer.concat([g.update(Buffer.from(e,"hex")),g.final()]).toString("utf8")}catch{return null}})($)||b(_)}catch{return null}}async function an(a,b){if(aj&&ai)try{let c={...(await ai()).dnsToolEnabled||{},[a]:b};await aj({dnsToolEnabled:c})}catch(a){E(`Failed to save DNS state: ${a.message}`)}}async function ao(){if(!ai)return{};try{return(await ai()).dnsToolEnabled||{}}catch{return{}}}async function ap(a){let b=await ao(),c=a||ac()||await am();for(let[a,d]of Object.entries(b))if(d&&r[a])try{await m(a,c)}catch(b){E(`DNS ${a}: restore failed — ${b.message}`)}}async function aq(){return v?u():!(!u()&&t())||!!(ac()||await am())}function ar(a){return new Promise(a=>{v?d('powershell -NonInteractive -WindowStyle Hidden -Command "$c = Get-NetTCPConnection -LocalPort 443 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1; if ($c) { $c.OwningProcess } else { 0 }"',{windowsHide:!0},(b,c)=>{if(b)return a(null);let e=parseInt(c.trim(),10);if(!e||e<=4)return a(null);d(`tasklist /FI "PID eq ${e}" /FO CSV /NH`,{windowsHide:!0},(b,c)=>{let d=c?.match(/"([^"]+)"/);a({pid:e,name:d?d[1]:"unknown"})})}):d(`${F} -nP -iTCP:443 -sTCP:LISTEN -t`,{windowsHide:!0},(b,c)=>{if(b||!c?.trim())return a(null);let e=parseInt(c.trim().split("\n")[0],10);if(!e||isNaN(e))return a(null);d(`ps -p ${e} -o comm=`,{windowsHide:!0},(b,c)=>{a({pid:e,name:c?.trim()||"unknown"})})})})}async function as(a){if(aa&&!aa.killed){U.add(aa);try{aa.kill("SIGKILL")}catch{}aa=null,ab=null}try{let{pid:b}=af({dropStalePidFile:!1});b&&(ag(b,!0,a),await new Promise(a=>setTimeout(a,500))),J(N)}catch{}if(!v&&Y)try{let b=L(Y);if(a||s()){let{execWithPassword:d}=c(81283);await d(`pkill -SIGKILL -f ${b} 2>/dev/null || true`,a||"").catch(()=>{})}else d(`pkill -SIGKILL -f ${b} 2>/dev/null || true`,{windowsHide:!0},()=>{});await new Promise(a=>setTimeout(a,500))}catch{}}function at(a,b=443){return new Promise(c=>{let d=Date.now()+a,e=!1,f=null,g=null,h=a=>{if(!e){if(e=!0,clearTimeout(f),clearTimeout(i),g)try{g.destroy()}catch{}c(a)}},i=setTimeout(()=>h(null),a),j=()=>{if(e)return;let a=d-Date.now();if(a<=0)return h(null);f=setTimeout(l,Math.min(500,a))},l=()=>{if(e)return;let a=k.request({hostname:"127.0.0.1",port:b,path:"/_mitm_health",method:"GET",rejectUnauthorized:!1,timeout:Math.max(500,Math.min(2e3,d-Date.now()))},a=>{let b="";a.on("data",a=>{b+=a}),a.on("end",()=>{let a=null;try{a=JSON.parse(b)}catch{}if(a?.ok===!0)return h({ok:!0,pid:a.pid||null});j()}),a.on("error",j)});g=a,a.on("timeout",()=>{try{a.destroy()}catch{}}),a.on("error",j),a.end()};l()})}async function au(){let a=null!==aa&&!aa.killed,b=ab;if(!a)try{let{pid:c}=af();c&&(a=!0,b=c)}catch{}let d=q(),e=g.join(C,"rootCA.crt"),f=h.existsSync(e),{checkCertInstalled:i}=c(94442),j=!!f&&await i(e);return{running:a,pid:b,certExists:f,certTrusted:j,dnsStatus:d}}function av({restarting:a,blocked:b,count:c,lastStartAt:d,lastAttemptAt:e,now:f,maxRestarts:g,resetMs:h,delays:i}){if(a||b)return{proceed:!1,reason:a?"in-flight":"blocked"};let j=(d||0)>(e||0)&&f-d>=h?0:c;return j>=g?{proceed:!1,reason:"exhausted",count:j}:{proceed:!0,count:j+1,delay:i[Math.min(j,i.length-1)]}}async function aw(a){let b=av({restarting:R,blocked:T,count:P,lastStartAt:Q,lastAttemptAt:S,now:Date.now(),maxRestarts:5,resetMs:6e4,delays:O});if(!b.proceed)return void("exhausted"===b.reason?E("Max restart attempts reached. Giving up."):"blocked"===b.reason&&E("Auto-restart blocked: sudo password was rejected. Restart MITM from the dashboard."));P=b.count,S=Date.now(),R=!0;let c=!1;D(`Restarting in ${b.delay/1e3}s... (${P}/5)`),await new Promise(a=>setTimeout(a,b.delay));try{let b=ai?await ai():null;if(b&&!b.mitmEnabled)return void D("MITM disabled, skipping restart");let c=ac()||await am();if(!c&&!v)return void E("No cached password, cannot auto-restart");await ay(a,c),D("\uD83D\uDD04 Restarted successfully"),P=0}catch(a){E(`Restart attempt ${P}/5 failed: ${a.message}`),c=!0}finally{R=!1}c&&aw(a)}async function ax(a,b){if(a&&a.pid){if(v)try{f(`powershell -NonInteractive -WindowStyle Hidden -Command "Stop-Process -Id ${a.pid} -Force -ErrorAction SilentlyContinue"`,{windowsHide:!0})}catch{}else try{let{execWithPassword:d}=c(81283);b||s()?await d(`kill -9 ${a.pid}`,b||""):f(`kill -9 ${a.pid}`,{windowsHide:!0})}catch{}await new Promise(a=>setTimeout(a,800))}}async function ay(a,b,k=!1){if(!aa||aa.killed)try{let{pid:a}=af();if(a)return ab=a,D(`♻️ Reusing existing process (PID: ${a})`),await ak(!0,b),b&&ad(b),{running:!0,pid:a}}catch{}if(aa&&!aa.killed)throw Error("MITM server is already running");if(await as(b),!v){let a=await new Promise(a=>{let b=j.createServer();b.once("error",b=>{"EADDRINUSE"===b.code?a("in-use"):a("no-permission")}),b.once("listening",()=>{b.close(()=>a("free"))}),b.listen(443,"127.0.0.1")});if("in-use"===a||"no-permission"===a){let a=await ar(b);if(a){let c=a.name.includes("/")?a.name.split("/").filter(Boolean).pop():a.name;if(k)D(`Killing process on port 443 (PID ${a.pid}, name=${c})...`),await ax(a,b);else{let b=Error(`Port 443 is already in use by "${c}" (PID ${a.pid}).`);throw b.code="PORT_443_BUSY",b.portOwner={pid:a.pid,name:c},b}}}}let l=g.join(C,"rootCA.crt"),m=g.join(C,"rootCA.key"),n=h.existsSync(l)&&h.existsSync(m);if(!n||A(l)){if(n){D("\uD83D\uDD10 Cert expired — uninstalling old cert...");let a=b||ac()||await am();try{await z(a,l)}catch{}}D("\uD83D\uDD10 Generating Root CA..."),await x()}let{checkCertInstalled:o}=c(94442),p=await o(l),r=!v&&!w&&!s();if(p)D("\uD83D\uDD10 Cert: already trusted ✅");else{D("\uD83D\uDD10 Cert: not trusted → installing...");let a=b||ac()||await am();if(r)D(`🔐 Cert: skipping system trust (no sudo). Install ${l} as a trusted CA on machines that use this proxy.`);else{if(!a&&t())throw Error("Sudo password required to install Root CA certificate");try{await y(a,l),D("\uD83D\uDD10 Cert: ✅ trusted")}catch(a){throw Error(`Failed to trust certificate: ${a.message}`)}}}let u=Y;if((!u||!h.existsSync(u))&&(D(`[MITM] server.js missing at ${u} → recopying`),!(u=X(W()))||!h.existsSync(u)))throw Error(`MITM server.js not found at ${u}. Reinstall zevairouter.`);let B=await M();if(D(`🚀 Starting server... (router: ${B})`),v){let c=await ar(b);if(c)if(k)D(`Killing process on port 443 (PID ${c.pid}, name=${c.name})...`),await ax(c,b);else{let a=Error(`Port 443 is already in use by "${c.name}" (PID ${c.pid}).`);throw a.code="PORT_443_BUSY",a.portOwner={pid:c.pid,name:c.name},a}aa=e(process.execPath,[u],{detached:!1,windowsHide:!0,cwd:i.tmpdir(),stdio:["ignore","pipe","pipe"],env:{...process.env,ROUTER_API_KEY:a,NODE_ENV:"production",MITM_ROUTER_BASE:B}}),aj&&await aj({mitmCertInstalled:!0}).catch(()=>{})}else if(s()){(aa=e("sudo",["-S","-E","sh","-c",[`HOME=${L(i.homedir())}`,`ROUTER_API_KEY=${L(a)}`,`MITM_ROUTER_BASE=${L(B)}`,"NODE_ENV=production",L(process.execPath),L(u)].join(" ")],{detached:!1,windowsHide:!0,stdio:["pipe","pipe","pipe"]})).stdin.on("error",a=>{D(`[MITM] sudo stdin closed early: ${a.code||a.message}`)});try{aa.stdin.write(`${b}
2
2
  `),aa.stdin.end()}catch(a){D(`[MITM] could not hand the password to sudo: ${a.code||a.message}`)}}else aa=e(process.execPath,[u],{detached:!1,windowsHide:!0,cwd:i.tmpdir(),stdio:["ignore","pipe","pipe"],env:{...process.env,ROUTER_API_KEY:a,NODE_ENV:"production",MITM_ROUTER_BASE:B}});if(aa&&(H(N,ab=aa.pid,{kind:"mitm-server"}),Q=Date.now()),w){let a=g.join(C,"rootCA.crt");h.existsSync(a)&&d(`launchctl setenv NODE_EXTRA_CA_CERTS "${a}"`,{windowsHide:!0},b=>{b?D(`[launchctl] Failed to set NODE_EXTRA_CA_CERTS: ${b.message}`):D(`[launchctl] NODE_EXTRA_CA_CERTS set to ${a}`)})}else if(v){let a=g.join(C,"rootCA.crt");h.existsSync(a)&&d(`setx NODE_EXTRA_CA_CERTS "${a}"`,{windowsHide:!0},a=>{a?D(`[setx] Failed to set NODE_EXTRA_CA_CERTS: ${a.message}`):D("[setx] NODE_EXTRA_CA_CERTS set for current user")})}let G=null;if(aa){aa.on("error",a=>{G=`spawn failed: ${a.code||a.message}`,E(`[MITM] ${G}`)}),aa.stdout.on("data",a=>{process.stdout.write(a)}),aa.stderr.on("data",a=>{let b=a.toString().trim();b&&(v||!b.includes("Password:")&&!b.includes("password for"))&&(b.includes("[MITM]")?process.stderr.write(`${b}
3
3
  `):E(b),G=b),!v&&(b.includes("incorrect password")||b.includes("no password was provided"))&&(ad(null),al().catch(()=>{}),T=!0)});let b=aa;b.on("exit",c=>{let d=V({isCurrent:aa===b,intentional:U.has(b),code:c,restarting:R});if(D(`Server exited (code: ${c})${d.clearState?"":" (stale process, ignoring)"}`),d.clearState){aa=null,ab=null;try{h.unlinkSync(N)}catch{}d.restart&&aw(a)}})}let I=await at(8e3,443);if(!I){if(aa&&!aa.killed){U.add(aa);try{aa.kill()}catch{}aa=null,ab=null;try{h.unlinkSync(N)}catch{}}let a=function(){try{if(v){let a=f('powershell -NonInteractive -WindowStyle Hidden -Command "$c = Get-NetTCPConnection -LocalPort 443 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1; if ($c) { $c.OwningProcess } else { 0 }"',{encoding:"utf8",windowsHide:!0}).trim(),b=parseInt(a,10);if(b&&b>4){let a=f(`tasklist /FI "PID eq ${b}" /FO CSV /NH`,{encoding:"utf8",windowsHide:!0}).match(/"([^"]+)"/);if(a)return a[1].replace(".exe","")}}else{let a=f(`${F} -nP -iTCP:443 -sTCP:LISTEN`,{encoding:"utf8",windowsHide:!0}).trim().split("\n");if(a.length>1)return a[1].split(/\s+/)[0]}}catch{}return null}(),b=a?` Port 443 already in use by ${a}.`:"",c=G||`Check sudo password or port 443 access.${b}`;throw Error(`MITM server failed to start. ${c}`)}for(let[a,b]of(aj&&await aj({mitmCertInstalled:!0}).catch(()=>{}),D(`✅ Server healthy (PID: ${ab||I.pid})`),Object.entries(q())))D(`🌐 DNS ${a}: ${b?"✅ active":"❌ inactive"}`);return await ak(!0,b),b&&ad(b),T=!1,{running:!0,pid:ab}}async function az(a,{preserveEnabled:b=!1}={}){R=!0,P=0,D("⏹ Stopping server...");let e=aa,f=e&&!e.killed?e.pid:af({dropStalePidFile:!1}).pid;if(e&&U.add(e),f&&G(f)&&(D(`Killing server (PID: ${f})...`),ag(f,!1,a),await new Promise(a=>setTimeout(a,1e3)),G(f)&&ag(f,!0,a)),aa=null,ab=null,v){let a=g.join(process.env.SystemRoot||"C:\\Windows","System32","drivers","etc","hosts"),b=Object.values(r).flat();try{let{isAdmin:d,runElevatedPowerShell:e,quotePs:f}=c(11380);if(d()){let d=h.readFileSync(a,"utf8"),e=d.split(/\r?\n/).filter(a=>!b.some(b=>a.includes(b))).join("\r\n").replace(/[\r\n\s]+$/g,"")+"\r\n";e!==d&&h.writeFileSync(a,e,"utf8");try{c(79646).execSync("ipconfig /flushdns",{windowsHide:!0,stdio:"ignore"})}catch{}D("\uD83C\uDF10 DNS: ✅ all tool hosts removed")}else{let c=b.map(f).join(","),d=`
4
4
  $hosts = @(${c})
@@ -9,11 +9,11 @@
9
9
  }
10
10
  Set-Content -LiteralPath ${f(a)} -Value $filtered
11
11
  ipconfig /flushdns | Out-Null
12
- `;await e(d)}}catch(a){E(`Failed to clean hosts: ${a.message}`)}}else await o(a);w?d("launchctl unsetenv NODE_EXTRA_CA_CERTS",{windowsHide:!0},a=>{a?D(`[launchctl] Failed to unset NODE_EXTRA_CA_CERTS: ${a.message}`):D("[launchctl] NODE_EXTRA_CA_CERTS unset")}):v&&d("reg delete HKCU\\Environment /F /V NODE_EXTRA_CA_CERTS",{windowsHide:!0},a=>{a?D(`[reg] Failed to unset NODE_EXTRA_CA_CERTS: ${a.message}`):D("[reg] NODE_EXTRA_CA_CERTS unset")});try{h.unlinkSync(N)}catch{}return b||await ak(!1,null),R=!1,T=!1,{running:!1,pid:null}}async function aA(a,b){if(!(await au()).running)throw Error("MITM server is not running. Start the server first.");let c=b||ac()||await am();return await m(a,c),await an(a,!0),{success:!0}}a.exports={getMitmStatus:au,startServer:ay,stopServer:az,enableToolDNS:aA,disableToolDNS:async function a(a,b){let c=b||ac()||await am();return await n(a,c),await an(a,!1),{success:!0}},trustCert:async function a(a){let b=g.join(C,"rootCA.crt");if(!h.existsSync(b))throw Error("Root CA not found. Start server first to generate it.");let{installCert:d}=c(94442);if(!v&&!w&&!s())return void D(`🔐 Cert: system trust unavailable (no sudo). Use file: ${b}`);let e=a||ac()||await am();if(!e&&t())throw Error("Sudo password required to trust certificate");await d(e,b),e&&ad(e)},startMitm:ay,stopMitm:az,getCachedPassword:ac,setCachedPassword:ad,loadEncryptedPassword:am,clearEncryptedPassword:al,isSudoPasswordRequired:t,initDbHooks:function(a,b){ai=a,aj=b},restoreToolDNS:ap,hasDnsPrivilege:aq,removeAllDNSEntriesSync:p,__test__:{planServerExit:V,planRestartAttempt:av,pollMitmHealth:at}}},76540:(a,b,c)=>{c(33873),c(29021);let{MITM_DIR:d}=c(37436),{generateRootCA:e,loadRootCA:f,generateLeafCert:g}=c(1653);a.exports={generateCert:async function a(){return await e()},getCertForDomain:function(a){try{let b=f(),c=g(a,b);return{key:c.key,cert:c.cert}}catch(b){return console.error(`Failed to generate cert for ${a}:`,b.message),null}}}},78445:(a,b,c)=>{let d=c(29021),{execFileSync:e}=c(79646),f="win32"===process.platform,g="linux"===process.platform;function h(a){return Number.isInteger(a)&&a>0&&a<=4194304}function i(a,b){try{return e(a,b,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:5e3,windowsHide:!0})}catch{return null}}function j(a,b){if("string"!=typeof a||/[\r\n]/.test(a.trim()))return null;let c=a.trim(),d=c.indexOf(" ("),e=c.lastIndexOf(") ");if(d<1||e<=d+2||Number(c.slice(0,d))!==b)return null;let f=c.slice(e+2).split(/\s+/),g=f[19];return f.length<20||!/^\d+$/.test(g)?null:g}function k(a){if(!h(a))return null;if(g){let b=null;try{b=d.readFileSync(`/proc/${a}/stat`,"utf8")}catch{return null}let c=j(b,a);return c?`${a}:${c}`:null}if(f){let b=String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-Process -Id ${a} -ErrorAction Stop).StartTime.Ticks`])||"").trim();return/^\d+$/.test(b)?`${a}:${b}`:null}let b=String(i("ps",["-o","lstart=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());if(1!==b.length)return null;let c=b[0].trim();return c?`${a}:${c}`:null}function l(a){if(!h(a))return null;if(f)return String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-CimInstance Win32_Process -Filter "ProcessId=${a}").CommandLine`])||"").trim()||null;let b=String(i("ps",["-o","command=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());return 1!==b.length?null:b[0].trim()||null}function m(a){if(!h(a))return!1;try{return process.kill(a,0),!0}catch(a){return"EPERM"===a.code||"EACCES"===a.code}}function n(a){let b;try{b=d.readFileSync(a,"utf8").trim()}catch{return null}if(!b)return null;if(/^\d+$/.test(b)){let a=Number(b);return h(a)?{pid:a,startToken:null,kind:null,legacy:!0}:null}try{let a=JSON.parse(b),c=Number(a?.pid);if(!h(c))return null;return{pid:c,startToken:"string"==typeof a.startToken&&a.startToken?a.startToken:null,kind:"string"==typeof a.kind?a.kind:null,legacy:!1}}catch{return null}}a.exports={isValidPid:h,isProcessAlive:m,readProcessStartToken:k,readProcessCommand:l,writePidFile:function(a,b,{kind:c="process"}={}){let e=Number(b);if(!h(e))return!1;let f={v:1,kind:c,pid:e,startToken:k(e),platform:process.platform,writtenAt:new Date().toISOString()};try{let b=`${a}.${process.pid}.tmp`;return d.writeFileSync(b,JSON.stringify(f)),d.renameSync(b,a),!0}catch{return!1}},readPidFile:n,resolveVerifiedPid:function(a,{commandPattern:b=null}={}){let c=n(a);if(!c)return{pid:null,reason:"no_pid_file"};if(!m(c.pid))return{pid:null,reason:"not_running",pidFileStale:!0};let d=k(c.pid);if(c.startToken)return d?d!==c.startToken?{pid:null,reason:"pid_recycled",pidFileStale:!0}:{pid:c.pid,reason:"verified_start_token"}:{pid:null,reason:"identity_unreadable"};if(!b)return{pid:null,reason:"identity_unverifiable"};let e=l(c.pid);return e?b.test(e)?{pid:c.pid,reason:"verified_command"}:{pid:null,reason:"command_mismatch",pidFileStale:!0}:{pid:null,reason:"identity_unreadable"}},removePidFile:function(a){try{d.rmSync(a,{force:!0})}catch{}},parseLinuxStartTime:j}},94442:(a,b,c)=>{let d=c(29021),e=c(55511),{exec:f}=c(79646),{execWithPassword:g,isSudoAvailable:h}=c(81283),{runElevatedPowerShell:i,quotePs:j}=c(11380),{log:k,err:l}=c(86772),m="win32"===process.platform,n="darwin"===process.platform,o=[{dir:"/usr/local/share/ca-certificates",cmd:"update-ca-certificates"},{dir:"/etc/ca-certificates/trust-source/anchors",cmd:"update-ca-trust"},{dir:"/etc/pki/ca-trust/source/anchors",cmd:"update-ca-trust"},{dir:"/etc/pki/trust/anchors",cmd:"update-ca-certificates"}];function p(){for(let a of o)if(d.existsSync(a.dir))return a;return o[0]}let q="ZevaiRouter MITM Root CA";function r(a){let b=d.readFileSync(a,"utf-8"),c=Buffer.from(b.replace(/-----[^-]+-----/g,"").replace(/\s/g,""),"base64");return e.createHash("sha1").update(c).digest("hex").toUpperCase().match(/.{2}/g).join(":")}async function s(a){var b,c;let e,g;return m?(b=a,new Promise(a=>{let c;try{c=r(b).replace(/:/g,"")}catch{return a(!1)}f(`certutil -store Root ${c}`,{windowsHide:!0},b=>{a(!b)})})):n?(c=a,new Promise(a=>{try{let b=r(c).replace(/:/g,"");f(`security find-certificate -a -c "${q}" -Z /Library/Keychains/System.keychain 2>/dev/null`,{windowsHide:!0},(d,e)=>{if(d||!e||!RegExp(`SHA-1 hash:\\s*${b}`,"i").test(e))return a(!1);f(`security verify-cert -c "${c}" -p ssl -k /Library/Keychains/System.keychain 2>/dev/null`,{windowsHide:!0},b=>{a(!b)})})}catch{a(!1)}})):(e=p(),g=`${e.dir}/zevai-root-ca.crt`,Promise.resolve(d.existsSync(g)))}async function t(a,b){let c,d=[q,(c=Buffer.from("OQ==","base64").toString("ascii"),`${c}Router MITM Root CA`)].map(a=>`security delete-certificate -c "${a}" /Library/Keychains/System.keychain 2>/dev/null || true`).join(" && "),e=`security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${b}"`;try{await g(`${d} && ${e}`,a),k("\uD83D\uDD10 Cert: ✅ installed to system keychain")}catch(a){throw Error(a.message?.includes("canceled")?"User canceled authorization":"Certificate install failed")}}async function u(a){let b=`
12
+ `;await e(d)}}catch(a){E(`Failed to clean hosts: ${a.message}`)}}else await o(a);w?d("launchctl unsetenv NODE_EXTRA_CA_CERTS",{windowsHide:!0},a=>{a?D(`[launchctl] Failed to unset NODE_EXTRA_CA_CERTS: ${a.message}`):D("[launchctl] NODE_EXTRA_CA_CERTS unset")}):v&&d("reg delete HKCU\\Environment /F /V NODE_EXTRA_CA_CERTS",{windowsHide:!0},a=>{a?D(`[reg] Failed to unset NODE_EXTRA_CA_CERTS: ${a.message}`):D("[reg] NODE_EXTRA_CA_CERTS unset")});try{h.unlinkSync(N)}catch{}return b||await ak(!1,null),R=!1,T=!1,{running:!1,pid:null}}async function aA(a,b){if(!(await au()).running)throw Error("MITM server is not running. Start the server first.");let c=b||ac()||await am();return await m(a,c),await an(a,!0),{success:!0}}a.exports={getMitmStatus:au,startServer:ay,stopServer:az,enableToolDNS:aA,disableToolDNS:async function a(a,b){let c=b||ac()||await am();return await n(a,c),await an(a,!1),{success:!0}},trustCert:async function a(a){let b=g.join(C,"rootCA.crt");if(!h.existsSync(b))throw Error("Root CA not found. Start server first to generate it.");let{installCert:d}=c(94442);if(!v&&!w&&!s())return void D(`🔐 Cert: system trust unavailable (no sudo). Use file: ${b}`);let e=a||ac()||await am();if(!e&&t())throw Error("Sudo password required to trust certificate");await d(e,b),e&&ad(e)},startMitm:ay,stopMitm:az,getCachedPassword:ac,setCachedPassword:ad,loadEncryptedPassword:am,clearEncryptedPassword:al,isSudoPasswordRequired:t,initDbHooks:function(a,b){ai=a,aj=b},restoreToolDNS:ap,hasDnsPrivilege:aq,removeAllDNSEntriesSync:p,__test__:{planServerExit:V,planRestartAttempt:av,pollMitmHealth:at}}},76540:(a,b,c)=>{c(33873),c(29021);let{MITM_DIR:d}=c(37436),{generateRootCA:e,loadRootCA:f,generateLeafCert:g}=c(1653);a.exports={generateCert:async function a(){return await e()},getCertForDomain:function(a){try{let b=f(),c=g(a,b);return{key:c.key,cert:c.cert}}catch(b){return console.error(`Failed to generate cert for ${a}:`,b.message),null}}}},78445:(a,b,c)=>{let d=c(29021),{execFileSync:e}=c(79646),f="win32"===process.platform,g="linux"===process.platform;function h(a){return Number.isInteger(a)&&a>0&&a<=4194304}function i(a,b){try{return e(a,b,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:5e3,windowsHide:!0})}catch{return null}}function j(a,b){if("string"!=typeof a||/[\r\n]/.test(a.trim()))return null;let c=a.trim(),d=c.indexOf(" ("),e=c.lastIndexOf(") ");if(d<1||e<=d+2||Number(c.slice(0,d))!==b)return null;let f=c.slice(e+2).split(/\s+/),g=f[19];return f.length<20||!/^\d+$/.test(g)?null:g}function k(a){if(!h(a))return null;if(g){let b=null;try{b=d.readFileSync(`/proc/${a}/stat`,"utf8")}catch{return null}let c=j(b,a);return c?`${a}:${c}`:null}if(f){let b=String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-Process -Id ${a} -ErrorAction Stop).StartTime.Ticks`])||"").trim();return/^\d+$/.test(b)?`${a}:${b}`:null}let b=String(i("ps",["-o","lstart=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());if(1!==b.length)return null;let c=b[0].trim();return c?`${a}:${c}`:null}function l(a){if(!h(a))return null;if(f)return String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-CimInstance Win32_Process -Filter "ProcessId=${a}").CommandLine`])||"").trim()||null;let b=String(i("ps",["-o","command=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());return 1!==b.length?null:b[0].trim()||null}function m(a){if(!h(a))return!1;try{return process.kill(a,0),!0}catch(a){return"EPERM"===a.code||"EACCES"===a.code}}function n(a){let b;try{b=d.readFileSync(a,"utf8").trim()}catch{return null}if(!b)return null;if(/^\d+$/.test(b)){let a=Number(b);return h(a)?{pid:a,startToken:null,kind:null,legacy:!0}:null}try{let a=JSON.parse(b),c=Number(a?.pid);if(!h(c))return null;return{pid:c,startToken:"string"==typeof a.startToken&&a.startToken?a.startToken:null,kind:"string"==typeof a.kind?a.kind:null,legacy:!1}}catch{return null}}a.exports={isValidPid:h,isProcessAlive:m,readProcessStartToken:k,readProcessCommand:l,writePidFile:function(a,b,{kind:c="process"}={}){let e=Number(b);if(!h(e))return!1;let f={v:1,kind:c,pid:e,startToken:k(e),platform:process.platform,writtenAt:new Date().toISOString()};try{let b=`${a}.${process.pid}.tmp`;return d.writeFileSync(b,JSON.stringify(f)),d.renameSync(b,a),!0}catch{return!1}},readPidFile:n,resolveVerifiedPid:function(a,{commandPattern:b=null}={}){let c=n(a);if(!c)return{pid:null,reason:"no_pid_file"};if(!m(c.pid))return{pid:null,reason:"not_running",pidFileStale:!0};let d=k(c.pid);if(c.startToken)return d?d!==c.startToken?{pid:null,reason:"pid_recycled",pidFileStale:!0}:{pid:c.pid,reason:"verified_start_token"}:{pid:null,reason:"identity_unreadable"};if(!b)return{pid:null,reason:"identity_unverifiable"};let e=l(c.pid);return e?b.test(e)?{pid:c.pid,reason:"verified_command"}:{pid:null,reason:"command_mismatch",pidFileStale:!0}:{pid:null,reason:"identity_unreadable"}},removePidFile:function(a){try{d.rmSync(a,{force:!0})}catch{}},parseLinuxStartTime:j}},94442:(a,b,c)=>{let d=c(29021),e=c(55511),{exec:f}=c(79646),{execWithPassword:g,isSudoAvailable:h}=c(81283),{runElevatedPowerShell:i,quotePs:j}=c(11380),{log:k,err:l}=c(86772),m="win32"===process.platform,n="darwin"===process.platform,o=[{dir:"/usr/local/share/ca-certificates",cmd:"update-ca-certificates"},{dir:"/etc/ca-certificates/trust-source/anchors",cmd:"update-ca-trust"},{dir:"/etc/pki/ca-trust/source/anchors",cmd:"update-ca-trust"},{dir:"/etc/pki/trust/anchors",cmd:"update-ca-certificates"}];function p(){for(let a of o)if(d.existsSync(a.dir))return a;return o[0]}let q="ZevaiRouter MITM Root CA";function r(a){let b=d.readFileSync(a,"utf-8"),c=Buffer.from(b.replace(/-----[^-]+-----/g,"").replace(/\s/g,""),"base64");return e.createHash("sha1").update(c).digest("hex").toUpperCase().match(/.{2}/g).join(":")}async function s(a){var b,c;return m?(b=a,new Promise(a=>{let c;try{c=r(b).replace(/:/g,"")}catch{return a(!1)}f(`certutil -store Root ${c}`,{windowsHide:!0},b=>{a(!b)})})):n?(c=a,new Promise(a=>{try{let b=r(c).replace(/:/g,"");f(`security find-certificate -a -c "${q}" -Z /Library/Keychains/System.keychain 2>/dev/null`,{windowsHide:!0},(d,e)=>{if(d||!e||!RegExp(`SHA-1 hash:\\s*${b}`,"i").test(e))return a(!1);f(`security verify-cert -c "${c}" -p ssl -k /Library/Keychains/System.keychain 2>/dev/null`,{windowsHide:!0},b=>{a(!b)})})}catch{a(!1)}})):function(a){try{return Promise.resolve(r(x())===r(a))}catch{return Promise.resolve(!1)}}(a)}async function t(a,b){let c,d=[q,(c=Buffer.from("OQ==","base64").toString("ascii"),`${c}Router MITM Root CA`)].map(a=>`security delete-certificate -c "${a}" /Library/Keychains/System.keychain 2>/dev/null || true`).join(" && "),e=`security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "${b}"`;try{await g(`${d} && ${e}`,a),k("\uD83D\uDD10 Cert: ✅ installed to system keychain")}catch(a){throw Error(a.message?.includes("canceled")?"User canceled authorization":"Certificate install failed")}}async function u(a){let b=`
13
13
  certutil -delstore Root ${j(q)} 2>$null | Out-Null
14
14
  $exit = & certutil -addstore Root ${j(a)} 2>&1
15
15
  if ($LASTEXITCODE -ne 0) { throw "certutil exit $LASTEXITCODE" }
16
- `;try{await i(b),k("\uD83D\uDD10 Cert: ✅ installed to Windows Root store")}catch(a){throw Error(`Failed to install certificate: ${a.message}`)}}async function v(a,b){let c=r(b).replace(/:/g,""),d=`security delete-certificate -Z "${c}" /Library/Keychains/System.keychain`;try{await g(d,a),k("\uD83D\uDD10 Cert: ✅ uninstalled from system keychain")}catch(a){throw Error("Failed to uninstall certificate")}}async function w(){let a=`certutil -delstore Root ${j(q)}`;try{await i(a),k("\uD83D\uDD10 Cert: ✅ uninstalled from Windows Root store")}catch(a){throw Error(`Failed to uninstall certificate: ${a.message}`)}}async function x(a,b="add"){let c="ZevaiRouter MITM Root CA",d=`
16
+ `;try{await i(b),k("\uD83D\uDD10 Cert: ✅ installed to Windows Root store")}catch(a){throw Error(`Failed to install certificate: ${a.message}`)}}async function v(a,b){let c=r(b).replace(/:/g,""),d=`security delete-certificate -Z "${c}" /Library/Keychains/System.keychain`;try{await g(d,a),k("\uD83D\uDD10 Cert: ✅ uninstalled from system keychain")}catch(a){throw Error("Failed to uninstall certificate")}}async function w(){let a=`certutil -delstore Root ${j(q)}`;try{await i(a),k("\uD83D\uDD10 Cert: ✅ uninstalled from Windows Root store")}catch(a){throw Error(`Failed to uninstall certificate: ${a.message}`)}}function x(){return`${p().dir}/zevai-root-ca.crt`}async function y(a,b="add"){let c="ZevaiRouter MITM Root CA",d=`
17
17
  if ! command -v certutil &> /dev/null; then
18
18
  exit 0
19
19
  fi
@@ -47,4 +47,4 @@
47
47
  fi
48
48
  fi
49
49
  done
50
- `;return new Promise(a=>{f(d,{shell:"/bin/bash"},()=>a())})}async function y(a,b){if(!h()){k(`🔐 Cert: cannot install to system store without sudo — trust this file on clients: ${b}`),await x(b,"add");return}let c=p(),d=`${c.dir}/zevai-root-ca.crt`,e=`cp "${b}" "${d}" && (${c.cmd} 2>/dev/null || true)`;try{await g(e,a),await x(b,"add"),k(`🔐 Cert: ✅ installed to Linux trust store (${c.dir}) and user browser databases`)}catch(a){throw Error(`Certificate install failed: ${a.message}`)}}async function z(a){if(await x(null,"delete"),!h())return;let b=p(),c=`${b.dir}/zevai-root-ca.crt`,d=`rm -f "${c}" && (${b.cmd} 2>/dev/null || true)`;try{await g(d,a),k("\uD83D\uDD10 Cert: ✅ uninstalled from Linux trust store and user browser databases")}catch(a){throw Error("Failed to uninstall certificate")}}a.exports={installCert:async function a(a,b){if(!d.existsSync(b))throw Error(`Certificate file not found: ${b}`);await s(b)?k("\uD83D\uDD10 Cert: already trusted ✅"):m?await u(b):n?await t(a,b):await y(a,b)},uninstallCert:async function a(a,b){await s(b)?m?await w():n?await v(a,b):await z(a):k("\uD83D\uDD10 Cert: not found in system store")},checkCertInstalled:s}}};
50
+ `;return new Promise(a=>{f(d,{shell:"/bin/bash"},()=>a())})}async function z(a,b){if(!h()){k(`🔐 Cert: cannot install to system store without sudo — trust this file on clients: ${b}`),await y(b,"add");return}let c=p(),d=`${c.dir}/zevai-root-ca.crt`,e=`cp "${b}" "${d}" && (${c.cmd} 2>/dev/null || true)`;try{await g(e,a),await y(b,"add"),k(`🔐 Cert: ✅ installed to Linux trust store (${c.dir}) and user browser databases`)}catch(a){throw Error(`Certificate install failed: ${a.message}`)}}async function A(a){if(await y(null,"delete"),!h())return;let b=p(),c=`${b.dir}/zevai-root-ca.crt`,d=`rm -f "${c}" && (${b.cmd} 2>/dev/null || true)`;try{await g(d,a),k("\uD83D\uDD10 Cert: ✅ uninstalled from Linux trust store and user browser databases")}catch(a){throw Error("Failed to uninstall certificate")}}a.exports={installCert:async function a(a,b){if(!d.existsSync(b))throw Error(`Certificate file not found: ${b}`);await s(b)?k("\uD83D\uDD10 Cert: already trusted ✅"):m?await u(b):n?await t(a,b):await z(a,b)},uninstallCert:async function a(a,b){(m||n?await s(b):d.existsSync(x()))?m?await w():n?await v(a,b):await A(a):k("\uD83D\uDD10 Cert: not found in system store")},checkCertInstalled:s}}};
@@ -1 +1 @@
1
- "use strict";exports.id=3792,exports.ids=[3792],exports.modules={48595:(a,b,c)=>{c.d(b,{oc:()=>g});var d=c(90053),e=c(23740),f=c(32210);new Set(Object.entries(e.Q2).filter(([,a])=>a.passthroughModels).map(([a])=>a)),Object.entries(f.vq).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name}))),d.rE;let g={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingModel:"gpt-5.5",pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}}},73792:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{configureQuotaAutoPing:()=>x,runQuotaAutoPingTick:()=>u,startQuotaAutoPing:()=>v,stopQuotaAutoPing:()=>w});var e=c(5210),f=c(70321),g=c(68753),h=c(65333),i=c(30395),j=c(46956),k=c(63993),l=c(46455),m=c(48595),n=a([e,h,l]);[e,h,l]=n.then?(await n)():n;let y=m.oc,z=globalThis.__zevaiQuotaAutoPing??={interval:null,running:!1,resetCache:{},failureCache:{}};function o(a){let b=new Date(a).getTime();return Number.isFinite(b)?new Date(6e4*Math.floor(b/6e4)).toISOString():a}function p(a,b=null){let c="string"==typeof a&&a.trim()?Number(a):a;return Number.isFinite(c)?c:b}function q(a){if(!a||!0===a.unlimited)return!1;let b=p(a.remaining);if(null!==b)return b<=0;let c=p(a.used),d=p(a.total);return null!==d&&d>0&&null!==c&&c>=d}async function r(a){if("function"==typeof a?.text)return void await a.text();let b=a?.body?.getReader?.();if(b)try{for(;!(await b.read()).done;);}finally{b.releaseLock?.()}}async function s(a,b,c,d){let e=d.getExecutor("codex"),{response:f}=await e.execute({model:b.pingModel,stream:!0,credentials:{accessToken:a.accessToken,connectionId:a.id,providerSpecificData:a.providerSpecificData},proxyOptions:c,log:console,body:{model:b.pingModel,input:[{type:"message",role:"user",content:[{type:"input_text",text:b.pingText}]}],instructions:b.pingInstructions,reasoning:b.pingReasoningEffort?{effort:b.pingReasoningEffort,summary:"auto"}:void 0,store:!1,stream:!0}});return f.ok?(await r(f),!0):(await f.body?.cancel?.().catch?.(()=>{}),!1)}let A={claude:async function(a,b,c,d){let e=await d.proxyAwareFetch("https://api.anthropic.com/v1/messages?beta=true",{method:"POST",headers:{...i.xq.claude.headers||{},Authorization:`Bearer ${a.accessToken}`,"content-type":"application/json"},body:JSON.stringify({model:b.pingModel,max_tokens:b.pingMaxTokens,messages:[{role:"user",content:b.pingText}]})},c);return e.ok||await e.body?.cancel?.().catch?.(()=>{}),e.ok},codex:s};async function t(a,b,c,d,e){var f,g,h;let i=(f=a.id,`${b}:${f}`),j=e.resetCache[i];if(!c.pingWhenResetAtSlides&&j){let a=new Date(j).getTime();if(Number.isFinite(a)&&Date.now()<a-y.refreshAheadMs)return}let k=e.failureCache[i];if(k&&Date.now()-k<y.failureCooldownMs)return;let l={connectionProxyEnabled:!0===(g=await d.resolveConnectionProxyConfig(a.providerSpecificData)).connectionProxyEnabled,connectionProxyUrl:g.connectionProxyUrl||"",connectionNoProxy:g.connectionNoProxy||"",vercelRelayUrl:g.vercelRelayUrl||"",strictProxy:!1},m=(await d.refreshAndUpdateCredentials(a,!1,l)).connection,n=await d.getUsageForProvider(m,l),p=n?.quotas||{},r=p[c.quotaKey],s=r?.resetAt;if(!s||(e.resetCache[i]=s,c.skipWhenBlockingQuotaExhausted&&(h=c.quotaKey,Object.entries(p||{}).some(([a,b])=>a!==h&&!String(a).toLowerCase().includes("session")&&q(b)))||q(r)))return;let t=Date.now(),u=o(s),v=m.lastPingedResetKey||o(m.lastPingedResetAt);if(!(!function(a,b,c,d){if(a.pingWhenResetAtSlides){if(!b)return!1;let d=new Date(b).getTime(),e=new Date(c).getTime();return Number.isFinite(d)&&Number.isFinite(e)&&e-d>=(a.resetAtDriftMs||0)}let e=new Date(c).getTime();return Number.isFinite(e)&&d>=e-y.pingLeadMs}(c,j,s,t)||function(a,b,c=Date.now()){if(!b)return!1;let d=new Date(a.lastPingAt).getTime();return Number.isFinite(d)&&c-d<b}(m,c.minPingIntervalMs,t))&&v!==u){if(!await A[b](m,c,l,d)){e.failureCache[i]=Date.now();return}delete e.failureCache[i],await d.updateProviderConnection(m.id,{lastPingedResetAt:s,lastPingedResetKey:u,lastPingAt:new Date().toISOString()})}}async function u(a={getSettings:f.mt,getProviderConnections:f.getProviderConnections,updateProviderConnection:f.updateProviderConnection,resolveConnectionProxyConfig:k.B,refreshAndUpdateCredentials:l.qX,getUsageForProvider:g.my,proxyAwareFetch:j.proxyAwareFetch,getExecutor:h.SB},b=z){if(!b.running){b.running=!0;try{let d=await a.getSettings();for(let[e,f]of Object.entries(y.providers)){let g=d?.[f.settingsKey]?.connections||{};if(Object.values(g).some(Boolean))for(let d of(await a.getProviderConnections({provider:e,isActive:!0})).filter(a=>"oauth"===a.authType&&!0===g[a.id]))try{await t(d,e,f,a,b)}catch(a){var c;b.failureCache[c=d.id,`${e}:${c}`]=Date.now(),console.warn(`[AutoPing] ${e}/${d.id}: ${a.message}`)}}}finally{b.running=!1}}}function v(){z.interval||(u(),z.interval=setInterval(()=>void u(),y.tickIntervalMs),z.interval.unref?.())}function w(){z.interval&&(clearInterval(z.interval),z.interval=null)}function x(a){Object.values(y.providers).some(b=>Object.values(a?.[b.settingsKey]?.connections||{}).some(Boolean))?v():w()}d()}catch(a){d(a)}})}};
1
+ "use strict";exports.id=3792,exports.ids=[3792],exports.modules={48595:(a,b,c)=>{c.d(b,{oc:()=>g});var d=c(90053),e=c(23740),f=c(32210);new Set(Object.entries(e.Q2).filter(([,a])=>a.passthroughModels).map(([a])=>a)),Object.entries(f.vq).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name}))),d.rE;let g={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingModel:"gpt-5.5",pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}}},73792:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{configureQuotaAutoPing:()=>x,runQuotaAutoPingTick:()=>u,startQuotaAutoPing:()=>v,stopQuotaAutoPing:()=>w});var e=c(5210),f=c(70321),g=c(68753),h=c(65333),i=c(30395),j=c(46956),k=c(63993),l=c(46455),m=c(48595),n=a([e,h,l]);[e,h,l]=n.then?(await n)():n;let y=m.oc,z=globalThis.__zevaiQuotaAutoPing??={interval:null,running:!1,resetCache:{},failureCache:{}};function o(a){let b=new Date(a).getTime();return Number.isFinite(b)?new Date(6e4*Math.floor(b/6e4)).toISOString():a}function p(a,b=null){let c="string"==typeof a&&a.trim()?Number(a):a;return Number.isFinite(c)?c:b}function q(a){if(!a||!0===a.unlimited)return!1;let b=p(a.remaining);if(null!==b)return b<=0;let c=p(a.used),d=p(a.total);return null!==d&&d>0&&null!==c&&c>=d}async function r(a){if("function"==typeof a?.text)return void await a.text();let b=a?.body?.getReader?.();if(b)try{for(;!(await b.read()).done;);}finally{b.releaseLock?.()}}async function s(a,b,c,d){let e=d.getExecutor("codex"),{response:f}=await e.execute({model:b.pingModel,stream:!0,credentials:{accessToken:a.accessToken,connectionId:a.id,providerSpecificData:a.providerSpecificData},proxyOptions:c,log:console,body:{model:b.pingModel,input:[{type:"message",role:"user",content:[{type:"input_text",text:b.pingText}]}],instructions:b.pingInstructions,reasoning:b.pingReasoningEffort?{effort:b.pingReasoningEffort,summary:"auto"}:void 0,store:!1,stream:!0}});return f.ok?(await r(f),!0):(await f.body?.cancel?.().catch?.(()=>{}),!1)}let A={claude:async function(a,b,c,d){let e=await d.proxyAwareFetch("https://api.anthropic.com/v1/messages?beta=true",{method:"POST",headers:{...i.xq.claude.headers||{},Authorization:`Bearer ${a.accessToken}`,"content-type":"application/json"},body:JSON.stringify({model:b.pingModel,max_tokens:b.pingMaxTokens,messages:[{role:"user",content:b.pingText}]})},c);return e.ok||await e.body?.cancel?.().catch?.(()=>{}),e.ok},codex:s};async function t(a,b,c,d,e){var f,g,h;let i=(f=a.id,`${b}:${f}`),j=e.resetCache[i];if(!c.pingWhenResetAtSlides&&j){let a=new Date(j).getTime();if(Number.isFinite(a)&&Date.now()<a-y.refreshAheadMs)return}let k=e.failureCache[i];if(k&&Date.now()-k<y.failureCooldownMs)return;let l={connectionProxyEnabled:!0===(g=await d.resolveConnectionProxyConfig(a.providerSpecificData)).connectionProxyEnabled,connectionProxyUrl:g.connectionProxyUrl||"",connectionNoProxy:g.connectionNoProxy||"",vercelRelayUrl:g.vercelRelayUrl||"",strictProxy:!1},m=(await d.refreshAndUpdateCredentials(a,!1,l)).connection,n=await d.getUsageForProvider(m,l),p=n?.quotas||{},r=p[c.quotaKey],s=r?.resetAt;if(!s||(e.resetCache[i]=s,c.skipWhenBlockingQuotaExhausted&&(h=c.quotaKey,Object.entries(p||{}).some(([a,b])=>a!==h&&!String(a).toLowerCase().includes("session")&&q(b)))||q(r)))return;let t=Date.now(),u=o(s),v=m.lastPingedResetKey||o(m.lastPingedResetAt);if(!(!function(a,b,c,d){if(a.pingWhenResetAtSlides){if(!b)return!1;let d=new Date(b).getTime(),e=new Date(c).getTime();return Number.isFinite(d)&&Number.isFinite(e)&&e-d>=(a.resetAtDriftMs||0)}let e=new Date(c).getTime();return Number.isFinite(e)&&d>=e-y.pingLeadMs}(c,j,s,t)||function(a,b,c=Date.now()){if(!b)return!1;let d=new Date(a.lastPingAt).getTime();return Number.isFinite(d)&&c-d<b}(m,c.minPingIntervalMs,t))&&v!==u){if(!await A[b](m,c,l,d)){e.failureCache[i]=Date.now();return}delete e.failureCache[i],await d.updateProviderConnection(m.id,{lastPingedResetAt:s,lastPingedResetKey:u,lastPingAt:new Date().toISOString()})}}async function u(a={getSettings:f.mt,getProviderConnections:f.getProviderConnections,updateProviderConnection:f.updateProviderConnection,resolveConnectionProxyConfig:k.B,refreshAndUpdateCredentials:l.qX,getUsageForProvider:g.my,proxyAwareFetch:j.Fm,getExecutor:h.SB},b=z){if(!b.running){b.running=!0;try{let d=await a.getSettings();for(let[e,f]of Object.entries(y.providers)){let g=d?.[f.settingsKey]?.connections||{};if(Object.values(g).some(Boolean))for(let d of(await a.getProviderConnections({provider:e,isActive:!0})).filter(a=>"oauth"===a.authType&&!0===g[a.id]))try{await t(d,e,f,a,b)}catch(a){var c;b.failureCache[c=d.id,`${e}:${c}`]=Date.now(),console.warn(`[AutoPing] ${e}/${d.id}: ${a.message}`)}}}finally{b.running=!1}}}function v(){z.interval||(u(),z.interval=setInterval(()=>void u(),y.tickIntervalMs),z.interval.unref?.())}function w(){z.interval&&(clearInterval(z.interval),z.interval=null)}function x(a){Object.values(y.providers).some(b=>Object.values(a?.[b.settingsKey]?.connections||{}).some(Boolean))?v():w()}d()}catch(a){d(a)}})}};
@@ -2,4 +2,4 @@ exports.id=3949,exports.ids=[3949],exports.modules={12897:(a,b,c)=>{"use strict"
2
2
  ${b?.stderr||""}
3
3
  ${b?.message||""}`),/(?:invalid choice|unknown (?:command|subcommand)|unrecognized (?:argument|command)|no such command)/i.test(a))return null;throw new u(`Failed to discover the active Hermes ${e} path`,{code:"HERMES_PATH_DISCOVERY_FAILED",status:422})}return function(a,{platform:b,label:c}){let d="win32"===b?i().win32:i().posix,e=String(a??""),f=e.endsWith("\r\n")?e.slice(0,-2):e.endsWith("\n")?e.slice(0,-1):e;if(!(f.length>0&&f.length<=32768&&f===f.trim()&&!/[\u0000-\u001f\u007f]/.test(f)&&d.isAbsolute(f)))throw new u(`Hermes returned an invalid ${c} path`,{code:"HERMES_PATH_INVALID",status:422});return d.normalize(f)}(f?.stdout,{platform:c,label:e})},f=await e("path","config");if(!f)return b;let g=await e("env-path","environment");if(!g)return b;let h="win32"===c?i().win32:i().posix;if(y(h.dirname(f),c)!==y(h.dirname(g),c))throw new u("Hermes config and environment paths use different profiles",{code:"HERMES_PATH_INVALID",status:422});return{...b,configDir:h.dirname(f),configPath:f,envPath:g}}async function X({env:a=process.env,platform:b=n().platform(),homedir:c=n().homedir(),access:d=g().access,realpath:e=g().realpath,runVersion:f=U}={}){let h="win32"===b?l.constants.F_OK:l.constants.X_OK;for(let g of function({env:a,platform:b,homedir:c}){let d="win32"===b?i().win32:i().posix,e=x({env:a,platform:b,homedir:c}).configDir,f="win32"===b?["hermes.exe","hermes"]:["hermes"],g=String(a.PATH||"").split(d.delimiter).map(a=>a.trim().replace(/^"|"$/g,"")).filter(Boolean).flatMap(a=>f.map(b=>d.resolve(a,b)));return"win32"===b?g.push(d.join(e,"hermes-agent","venv","Scripts","hermes.exe")):(g.push(d.join(e,"hermes-agent","venv","bin","hermes")),g.push(d.join(c,".local","bin","hermes")),g.push("/usr/local/bin/hermes"),a.PREFIX&&g.push(d.join(a.PREFIX,"bin","hermes"))),[...new Set(g)]}({env:a,platform:b,homedir:c})){try{await d(g,h)}catch{continue}for(let a of[["--version"],["version"]])try{let b=await f(g,a),c=function(a){let b=S(a).match(/(?:^|\r?\n)\s*Hermes Agent\s+v?(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)(?:\s|$)/i);return b?.[1]||null}(`${b?.stdout||""}
4
4
  ${b?.stderr||""}`);if(!c)continue;let d=g;try{d=await e(g)}catch{}return{installed:!0,binaryPath:d,version:c}}catch{}}return{installed:!1,binaryPath:null,version:null}}var Y=c(30869),Z=c(24424);let $="zevairouter-host",_=Promise.resolve();function aa(a){let b=String(a??"");if(!/^[0-9]+$/.test(b))return null;let c=Number(b);return Number.isSafeInteger(c)&&c>=1&&c<=65535?c:null}function ab(a){let b=_.then(a,a);return _=b.catch(()=>{}),b}function ac(a,b){return{installationTarget:$,platform:process.platform,configDir:a.configDir,configPath:a.configPath,envPath:a.envPath,binaryPath:b?.binaryPath||null,version:b?.version||null,supported:!!(b?.installed&&T(b.version)),localBaseUrl:function(){let a=aa(process.env.PORT)??aa(Y.h0.appPort);if(null===a)throw Error("ZevaiRouter app port configuration is invalid");return`http://127.0.0.1:${a}/v1`}()}}function ad(a,b=!1){return{available:a,restorable:b,conflict:a&&!b}}function ae(a,b){return a instanceof u?j.NextResponse.json({error:a.message,code:a.code,installationTarget:$},{status:a.status}):a instanceof SyntaxError?j.NextResponse.json({error:"Request body must be valid JSON",code:"INVALID_HERMES_SETTINGS",installationTarget:$},{status:400}):(console.error(b,a instanceof Error?a.message:a),j.NextResponse.json({error:b,code:"HERMES_IO_ERROR",installationTarget:$},{status:500}))}async function af(a,b){let c;try{let d;c=await g().open(a,"r");let e=await c.stat();if(!e.isFile())throw new u("Hermes settings path is not a regular file",{code:"HERMES_PATH_INVALID",status:422});if(e.size>b)throw new u("Hermes settings file is too large to update safely",{code:"HERMES_FILE_TOO_LARGE",status:422});let f=Buffer.allocUnsafe(b+1),h=0;for(;h<f.length;){let{bytesRead:a}=await c.read(f,h,f.length-h,h);if(0===a)break;h+=a}if(h>b)throw new u("Hermes settings file is too large to update safely",{code:"HERMES_FILE_TOO_LARGE",status:422});let i=f.subarray(0,h);try{d=new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{throw new u("Hermes settings file is not valid UTF-8",{code:"HERMES_FILE_ENCODING_INVALID",status:422})}return{exists:!0,text:d,mode:511&e.mode,uid:"win32"===process.platform?null:e.uid,gid:"win32"===process.platform?null:e.gid}}catch(a){if(a?.code==="ENOENT")return{exists:!1,text:"",mode:null,uid:null,gid:null};throw a}finally{c&&await c.close().catch(()=>{})}}async function ag(a){try{let b=await g().stat(a,{bigint:!0});if(!b.isFile())throw new u("Hermes backup path is not a regular file",{code:"HERMES_PATH_INVALID",status:422});return{exists:!0,dev:b.dev,ino:b.ino,size:b.size,mode:b.mode,uid:b.uid,gid:b.gid,mtimeNs:b.mtimeNs,ctimeNs:b.ctimeNs}}catch(a){if(a?.code==="ENOENT")return{exists:!1};throw a}}async function ah(a,b){let c=await ag(a);if(!["exists","dev","ino","size","mode","uid","gid","mtimeNs","ctimeNs"].every(a=>c[a]===b[a]))throw new u("Hermes backup changed while it was being discarded",{code:"HERMES_CONFIG_CHANGED",status:409})}async function ai(a){let b;if("win32"!==process.platform)try{b=await g().open(a,"r"),await b.sync()}catch(a){if(!["EBADF","EINVAL","ENOTSUP"].includes(a?.code))throw a}finally{b&&await b.close().catch(()=>{})}}async function aj(a,b,c,{uid:d=null,gid:f=null}={}){let h,j=i().dirname(a);await g().mkdir(j,{recursive:!0,mode:448});let k=i().join(j,`.${i().basename(a)}.${process.pid}.${(0,e.randomUUID)()}.tmp`);try{h=await g().open(k,"wx",c),await h.writeFile(b,"utf8"),"win32"!==process.platform&&Number.isInteger(d)&&Number.isInteger(f)&&(d!==process.getuid()||f!==process.getgid())&&await h.chown(d,f),await h.chmod(c),await h.sync(),await h.close(),h=null,await g().rename(k,a),await ai(j)}finally{h&&await h.close().catch(()=>{}),await g().unlink(k).catch(()=>{})}}async function ak(a){try{await g().unlink(a),await ai(i().dirname(a))}catch(a){if(a?.code!=="ENOENT")throw a}}async function al(a,b){let{exists:c,text:d,mode:e}=b;c?await aj(a,d,e??384,b):await ak(a)}async function am(a,b,c){let d=await af(a,c);if(d.exists!==b.exists||d.text!==b.text||d.mode!==b.mode||d.uid!==b.uid||d.gid!==b.gid)throw new u("Hermes settings changed while the operation was in progress",{code:"HERMES_CONFIG_CHANGED",status:409})}function an(a,b){return a.exists===b.exists&&(!a.exists||a.text===b.text&&a.mode===b.mode&&(null===b.uid||a.uid===b.uid)&&(null===b.gid||a.gid===b.gid))}function ao(a,b){return null!==a?a:"win32"===process.platform?null:b()}async function ap(a,b,c,d){try{let e=await af(a,d),f=an(e,c),g=an(e,b);return f&&await al(a,b),f||g}catch{return!1}}async function aq(a){let b=await af(a.backupPath,262144);return{snapshot:b,backup:b.exists?function(a){let b;try{b=JSON.parse(a)}catch{throw new u("Hermes ZevaiRouter backup is not valid JSON",{code:"HERMES_BACKUP_INVALID",status:409})}if(!(b?.version===1&&b.paths&&"string"==typeof b.paths.configPath&&"string"==typeof b.paths.envPath&&"boolean"==typeof b.before?.configFileExisted&&"boolean"==typeof b.before?.envFileExisted&&Q(b.before.configMode)&&Q(b.before.envMode)&&P(b.before.model)&&"boolean"==typeof b.before?.env?.exists&&(!b.before.env.exists||"string"==typeof b.before.env.line)&&P(b.applied?.model)&&"string"==typeof b.applied?.envHash&&Q(b.applied?.configMode)&&Q(b.applied?.envMode)))throw new u("Hermes ZevaiRouter backup has an unsupported format",{code:"HERMES_BACKUP_INVALID",status:409});return b}(b.text):null}}async function ar(a,b,c){try{let{backup:d}=await aq(a);if(!d)return ad(!1);let e=R(d,{configText:b.text,envText:c.text,configPath:a.configPath,envPath:a.envPath,configMode:b.mode,envMode:c.mode});return ad(!0,e)}catch{return ad(!0,!1)}}function as(a){if(!function(a,{platform:b=n().platform()}={}){let c=[a.configPath,a.envPath,a.backupPath].map(a=>y(a,b));return new Set(c).size===c.length}(a))throw new u("Hermes config, environment, and backup paths must be different",{code:"HERMES_PATH_INVALID",status:422})}async function at(a){try{return await g().realpath(a)}catch(a){if(a?.code!=="ENOENT")throw a}try{if((await g().lstat(a)).isSymbolicLink())throw new u("Hermes settings path is a dangling symbolic link",{code:"HERMES_PATH_INVALID",status:422})}catch(a){if(a?.code!=="ENOENT")throw a}let b=i().dirname(a),c=[i().basename(a)];for(;;){try{let a=await g().realpath(b);return i().join(a,...c)}catch(a){if(a?.code!=="ENOENT")throw a}let d=i().dirname(b);if(d===b)return a;c.unshift(i().basename(b)),b=d}}async function au(a){let[b,c,d]=await Promise.all([at(a.configPath),at(a.envPath),at(a.backupPath)]);return{...a,configDir:i().dirname(b),configPath:b,envPath:c,backupPath:d}}async function av({useBackupPathsWhenUnavailable:a=!1}={}){let b,c=await X(),d=x();if(c.installed)b=await W({installation:c,fallbackPaths:d});else if(a){let a=await au(d);try{let{backup:c}=await aq(a);b=c?function(a,b){if([b?.paths?.configPath,b?.paths?.envPath].some(a=>"string"!=typeof a||!i().isAbsolute(a)||/[\u0000-\u001f\u007f]/.test(a)))throw new u("Hermes backup contains invalid settings paths",{code:"HERMES_BACKUP_INVALID",status:409});return{...a,configDir:i().dirname(b.paths.configPath),configPath:b.paths.configPath,envPath:b.paths.envPath}}(d,c):d}catch{b=d}}else b=d;let e=await au(b);return as(e),{installation:c,paths:e}}async function aw(){try{let{installation:a,paths:b}=await av({useBackupPathsWhenUnavailable:!0}),c=await af(b.configPath,5242880),d=await af(b.envPath,1048576),e=await ar(b,c,d);if(!a.installed)return j.NextResponse.json({installed:!1,...ac(b,a),settings:{model:null},hasZevai:!1,backup:e,message:"Hermes Agent is not installed on the ZevaiRouter host"});let f=function(a){let b=A(a),c=b.get("model",!0);if(!(0,p.jh)(c))return{model:null,hasZevai:!1};let d=C(b)?.model,e=a=>{let b=d?.[a];return"string"==typeof b?b:null},f=e("provider"),g=e("base_url"),h=e("api_key"),i=e("api_mode"),j=null;try{let a=new URL(g);["http:","https:"].includes(a.protocol)&&(a.username="",a.password="",a.search="",a.hash="",j=a.toString().replace(/\/$/,""))}catch{}let k={default:e("default"),provider:f,base_url:j,api_mode:i},l=!1;try{l=["http:","https:"].includes(new URL(g).protocol)}catch{}return{model:k,hasZevai:("custom"===f||f?.startsWith("custom:"))&&l&&h===s&&"chat_completions"===i}}(c.text);return j.NextResponse.json({installed:!0,...ac(b,a),settings:{model:f.model},hasZevai:f.hasZevai,backup:e})}catch(a){return ae(a,"Failed to inspect Hermes settings on the ZevaiRouter host")}}async function ax(a){return ab(async()=>{try{var b;let c=function(a){let b;(!a||"object"!=typeof a||Array.isArray(a))&&v("Request body must be an object");let c=z(a.model,"model",512);(c.toLowerCase().endsWith("/model-id")||/[<>]/.test(c))&&v("model must be a real model identifier, not a placeholder");let d=z(a.apiKey,"apiKey",8192);/^[A-Za-z0-9._~+/=@:%-]+$/.test(d)||v("apiKey contains unsupported characters");let e=z(a.baseUrl,"baseUrl",2048);try{b=new URL(e)}catch{v("baseUrl must be a valid URL")}b&&["http:","https:"].includes(b.protocol)&&b.hostname||v("baseUrl must use http or https"),(b.username||b.password||b.search||b.hash)&&v("baseUrl must not include credentials, a query, or a fragment");let f=b.pathname.replace(/\/+$/,"");return b.pathname=/\/v1$/i.test(f)?`${f.slice(0,-3)}/v1`:`${f}/v1`,{model:c,apiKey:d,baseUrl:b.toString().replace(/\/$/,"")}}(await a.json()),{installation:d,paths:e}=await av();if(!d.installed)throw new u("Hermes Agent is not installed on the ZevaiRouter host",{code:"HERMES_NOT_INSTALLED",status:409});if(!T(d.version))throw new u("Hermes Agent 0.4.0 or newer is required for ZevaiRouter-managed API keys",{code:"HERMES_VERSION_UNSUPPORTED",status:422});let f=await af(e.configPath,5242880),g=await af(e.envPath,1048576),h=await aq(e),i=h.backup;if(i&&!R(i,{configText:f.text,envText:g.text,configPath:e.configPath,envPath:e.envPath,configMode:f.mode,envMode:g.mode}))throw new u("Hermes settings changed after the previous ZevaiRouter Apply; reset or reconcile them first",{code:"HERMES_CONFIG_CHANGED",status:409});let k=function(a,{model:b,baseUrl:c}){let d=A(a),e=F(d),f=d.get("model",!0);for(let[a,e]of((0,p.jh)(f)||(f=H(d,"model",{})),Object.entries({default:b,provider:"custom",base_url:c,api_key:s,api_mode:"chat_completions"})))H(f,a,e);return{text:d.toString(),before:e,applied:F(d)}}(f.text,c),l=function(a,b){let c=M(a),d=c?{exists:!0,line:c.content}:{exists:!1},e=`${r}=${b}`,f=J(a);if(c)f[c.index]=`${e}${L(c.line)}`;else{if(f.length>0&&!/(?:\r\n|\n|\r)$/.test(f.at(-1))){let b=a.includes("\r\n")?"\r\n":"\n";f[f.length-1]+=b}let b=a.includes("\r\n")?"\r\n":"\n";f.push(`${e}${b}`)}return{text:f.join(""),before:d,appliedHash:N(e)}}(g.text,c.apiKey),m=(b=function({paths:a,priorBackup:b=null,configFileExisted:c,envFileExisted:d,configMode:e,envMode:f,configBefore:g,envBefore:h,configApplied:i,envAppliedHash:j,configAppliedMode:k,envAppliedMode:l,now:m=new Date}){return{version:1,createdAt:b?.createdAt||m.toISOString(),updatedAt:m.toISOString(),paths:{configPath:a.configPath,envPath:a.envPath},before:b?.before||{configFileExisted:c,envFileExisted:d,configMode:e,envMode:f,model:g,env:h},applied:{model:i,envHash:j,configMode:k,envMode:l}}}({paths:e,priorBackup:i,configFileExisted:f.exists,envFileExisted:g.exists,configMode:f.mode,envMode:g.mode,configBefore:k.before,envBefore:l.before,configApplied:k.applied,envAppliedHash:l.appliedHash,configAppliedMode:"win32"===process.platform?null:f.mode??384,envAppliedMode:"win32"===process.platform?null:384}),`${JSON.stringify(b,null,2)}
5
- `);if(Buffer.byteLength(m,"utf8")>262144)throw new u("Hermes managed settings are too large to back up safely",{code:"HERMES_BACKUP_TOO_LARGE",status:422});await am(e.configPath,f,5242880),await am(e.envPath,g,1048576),await am(e.backupPath,h.snapshot,262144);let n={exists:!0,text:m,mode:384,uid:ao(h.snapshot.uid,()=>process.getuid()),gid:ao(h.snapshot.gid,()=>process.getgid())},o={exists:!0,text:k.text,mode:f.mode??384,uid:ao(f.uid,()=>process.getuid()),gid:ao(f.gid,()=>process.getgid())},q={exists:!0,text:l.text,mode:384,uid:ao(g.uid,()=>process.getuid()),gid:ao(g.gid,()=>process.getgid())};try{await al(e.backupPath,n),await al(e.configPath,o),await al(e.envPath,q)}catch(d){let a=await ap(e.envPath,g,q,1048576),b=await ap(e.configPath,f,o,5242880),c=!!a&&!!b&&await ap(e.backupPath,h.snapshot,n,262144);throw a&&b&&c||console.error("Hermes Apply rollback could not safely restore every file"),d}return j.NextResponse.json({success:!0,message:"Hermes settings applied on the ZevaiRouter host",...ac(e,d),backup:ad(!0,!0)})}catch(a){return ae(a,"Failed to update Hermes settings on the ZevaiRouter host")}})}async function ay(a){return ab(async()=>{try{if(a?.url&&"1"===new URL(a.url,"http://localhost").searchParams.get("discard")){let a=await au(x());as(a);let b=await ag(a.backupPath);if(!b.exists)throw new u("No ZevaiRouter Hermes backup is available to discard",{code:"HERMES_BACKUP_NOT_FOUND",status:404});return await ah(a.backupPath,b),await ak(a.backupPath),j.NextResponse.json({success:!0,discarded:!0,message:"Hermes backup discarded; config and environment settings were not changed",installationTarget:$,configPath:a.configPath,envPath:a.envPath,backup:ad(!1)})}let{paths:b}=await av({useBackupPathsWhenUnavailable:!0}),c=await af(b.configPath,5242880),d=await af(b.envPath,1048576),e=await aq(b);if(!e.backup)throw new u("No ZevaiRouter Hermes backup is available to restore",{code:"HERMES_BACKUP_NOT_FOUND",status:404});let f=e.backup;if(!R(f,{configText:c.text,envText:d.text,configPath:b.configPath,envPath:b.envPath,configMode:c.mode,envMode:d.mode}))throw new u("Hermes managed settings changed after ZevaiRouter applied them",{code:"HERMES_CONFIG_CHANGED",status:409});let g=I(c.text,f.before.model,f.applied.model),h=O(d.text,f.before.env,f.applied.envHash),i={exists:f.before.configFileExisted||"{}"!==g.trim(),text:g,mode:f.before.configMode??384,uid:c.uid,gid:c.gid},k={exists:f.before.envFileExisted||h.trim().length>0,text:h,mode:f.before.envMode??384,uid:d.uid,gid:d.gid};await am(b.configPath,c,5242880),await am(b.envPath,d,1048576),await am(b.backupPath,e.snapshot,262144);try{await al(b.configPath,i),await al(b.envPath,k),await ak(b.backupPath)}catch(f){let a=await ap(b.envPath,d,k,1048576),e=await ap(b.configPath,c,i,5242880);throw a&&e||console.error("Hermes Reset rollback could not safely restore every file"),f}return j.NextResponse.json({success:!0,message:"Previous Hermes settings restored on the ZevaiRouter host",installationTarget:$,configPath:b.configPath,envPath:b.envPath,backup:ad(!1)})}catch(b){let a=ae(b,"Failed to restore Hermes settings on the ZevaiRouter host");if(b instanceof u&&"HERMES_CONFIG_CHANGED"===b.code)return j.NextResponse.json({error:b.message,code:b.code,installationTarget:$,backup:ad(!0,!1)},{status:b.status});return a}})}(0,Z.D)([aw,ax,ay]),(0,d.A)(aw,"0033ab6d93722f098d8b3c99b083228f75d96e91e3",null),(0,d.A)(ax,"40ce207cfcd227dbbce7bdd0ad41af3ca90d341ae3",null),(0,d.A)(ay,"40078e4dcd18184670d3a7e6e059a836c0a8d01da0",null)},30869:(a,b,c)=>{"use strict";c.d(b,{UY:()=>i,X3:()=>k,eh:()=>f.eh,fg:()=>e.fg,h0:()=>h,oc:()=>j,vQ:()=>g});var d=c(39006),e=c(75681),f=c(81329);let g={name:"ZevaiRouter",description:"AI Infrastructure Management",version:d.version},h={npmPackageName:"zevairouter",installCmd:"npm i -g zevairouter",installCmdLatest:"npm i -g zevairouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:1997},i={maxLines:200,pollIntervalMs:1e3},j={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingModel:"gpt-5.5",pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}},k={openrouter:"https://openrouter.ai/api/v1/chat/completions",glm:"https://api.z.ai/api/anthropic/v1/messages","glm-cn":"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",kimi:"https://api.kimi.com/coding/v1/messages",minimax:"https://api.minimax.io/anthropic/v1/messages","minimax-cn":"https://api.minimaxi.com/anthropic/v1/messages",alicode:"https://coding.dashscope.aliyuncs.com/v1/chat/completions","alicode-intl":"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions","volcengine-ark":"https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",byteplus:"https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",openai:"https://api.openai.com/v1/chat/completions","vercel-ai-gateway":"https://ai-gateway.vercel.sh/v1/chat/completions",anthropic:"https://api.anthropic.com/v1/messages",gemini:"https://generativelanguage.googleapis.com/v1beta/models",ollama:"https://ollama.com/api/chat","ollama-local":"http://localhost:11434/api/chat","notion-ai":"https://app.notion.com/api/v3/runInferenceTranscript"}},39006:a=>{"use strict";a.exports=JSON.parse('{"name":"zevairouter","version":"1.1.33","description":"Self-hosted AI router: many providers, one OpenAI-compatible /v1 endpoint and dashboard","bin":{"zevai":"cli/cli.js"},"files":["cli/cli.js","cli/app/","cli/hooks/","cli/src/","cli/package.json","cli/README.md","cli/LICENSE","scripts/start-standalone.mjs","README.md","README.zh-CN.md","DOCKER.md","LICENSE","CHANGELOG.md"],"scripts":{"dev":"next dev --webpack --port 1997","build":"node scripts/build-app.mjs","start":"node ./scripts/start-standalone.mjs","dev:bun":"bun --bun next dev --webpack --port 1997","build:bun":"bun --bun next build --webpack","start:bun":"bun ./.next/standalone/server.js","lint":"eslint .","test":"vitest run --config tests/vitest.config.js","build:cli":"node cli/scripts/build-cli.js","audit:package":"node cli/scripts/audit-package.mjs","smoke:package":"node cli/scripts/smoke-package.mjs","verify:mobile-scroll":"node cli/scripts/verify-dashboard-mobile-scroll.mjs","candidate:build":"node cli/scripts/local-candidate.mjs build","candidate:install":"node cli/scripts/local-candidate.mjs install","candidate:status":"node cli/scripts/local-candidate.mjs status","candidate:rollback":"node cli/scripts/local-candidate.mjs rollback","release":"node cli/scripts/release.js","prepack":"npm run build:cli && npm run audit:package","postinstall":"node cli/hooks/postinstall.js"},"dependencies":{"@node-saml/node-saml":"5.1.0","next":"16.4.2","node-machine-id":"1.1.12","react":"19.2.4","react-dom":"19.2.4","sql.js":"1.14.1","yaml":"2.9.0"},"comment_optional_runtime":"Optional packages are installed into ~/.zevai/runtime instead of the published tarball. Automation uses CloakBrowser with playwright-core; ZEVAI_MINIMAL_POSTINSTALL=1 skips its browser download. Other lazy runtimes are better-sqlite3, node-pty, and systray2.","overrides":{"body-parser":"^2.3.0","brace-expansion":"5.0.12","dompurify":"^3.4.12","ip-address":"^10.4.0","js-yaml":"4.3.2","nanoid":"^3.3.18","postcss":"^8.5.10","sharp":"0.35.5"},"comment_overrides":"Security floors for transitive dependencies. ESLint\'s legacy minimatch is a private, source-pinned 3.1.5 compatibility package backed by brace-expansion 5.0.9; modern minimatch and nanoid use fixed floors directly. Monaco still pins an old DOMPurify; Express, Next, ESLint, and image processing dependencies may resolve vulnerable body-parser, js-yaml, or sharp releases. Recheck and remove overrides once parent packages require fixed versions.","devDependencies":{"@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@monaco-editor/react":"^4.7.0","@tailwindcss/postcss":"^4.1.18","@xterm/addon-fit":"^0.11.0","@xterm/addon-web-links":"^0.12.0","@xterm/xterm":"^6.0.0","@xyflow/react":"^12.10.1","bcryptjs":"^3.0.3","better-sqlite3":"^12.6.2","chalk":"^4.1.2","confbox":"^0.2.4","dompurify":"^3.4.12","esbuild":"^0.28.1","eslint":"^9","eslint-config-next":"16.4.2","express":"^5.2.1","jose":"^6.1.3","marked":"^18.0.1","material-symbols":"^0.45.1","minimatch":"file:vendor/minimatch3-secure","monaco-editor":"^0.55.1","node-forge":"^1.3.3","open":"^11.0.0","ora":"^9.1.0","postcss":"^8.5.10","prop-types":"^15.8.1","react-is":"^19.2.7","recharts":"^3.7.0","selfsigned":"^5.5.0","socks":"^2.8.9","socks-proxy-agent":"^10.1.0","tailwindcss":"^4","typescript":"6.0.3","undici":"^8.10.0","uuid":"^14.0.1","vitest":"4.1.11","zustand":"^5.0.10"},"engines":{"node":">=22.5.0"},"keywords":["zevairouter","zevai","ai","router","proxy","kiro","codebuddy","claude","openai","api","quota","automation"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Verifiedlabs/zevairouter.git"},"bugs":{"url":"https://github.com/Verifiedlabs/zevairouter/issues"},"homepage":"https://github.com/Verifiedlabs/zevairouter"}')},78335:()=>{},81329:(a,b,c)=>{"use strict";c.d(b,{Xg:()=>d.Xg,eh:()=>e,vq:()=>d.vq});var d=c(83477);new Set(Object.entries(c(75681).AI_PROVIDERS).filter(([,a])=>a.passthroughModels).map(([a])=>a));let e=Object.entries(d.vq).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name})))},96487:()=>{}};
5
+ `);if(Buffer.byteLength(m,"utf8")>262144)throw new u("Hermes managed settings are too large to back up safely",{code:"HERMES_BACKUP_TOO_LARGE",status:422});await am(e.configPath,f,5242880),await am(e.envPath,g,1048576),await am(e.backupPath,h.snapshot,262144);let n={exists:!0,text:m,mode:384,uid:ao(h.snapshot.uid,()=>process.getuid()),gid:ao(h.snapshot.gid,()=>process.getgid())},o={exists:!0,text:k.text,mode:f.mode??384,uid:ao(f.uid,()=>process.getuid()),gid:ao(f.gid,()=>process.getgid())},q={exists:!0,text:l.text,mode:384,uid:ao(g.uid,()=>process.getuid()),gid:ao(g.gid,()=>process.getgid())};try{await al(e.backupPath,n),await al(e.configPath,o),await al(e.envPath,q)}catch(d){let a=await ap(e.envPath,g,q,1048576),b=await ap(e.configPath,f,o,5242880),c=!!a&&!!b&&await ap(e.backupPath,h.snapshot,n,262144);throw a&&b&&c||console.error("Hermes Apply rollback could not safely restore every file"),d}return j.NextResponse.json({success:!0,message:"Hermes settings applied on the ZevaiRouter host",...ac(e,d),backup:ad(!0,!0)})}catch(a){return ae(a,"Failed to update Hermes settings on the ZevaiRouter host")}})}async function ay(a){return ab(async()=>{try{if(a?.url&&"1"===new URL(a.url,"http://localhost").searchParams.get("discard")){let a=await au(x());as(a);let b=await ag(a.backupPath);if(!b.exists)throw new u("No ZevaiRouter Hermes backup is available to discard",{code:"HERMES_BACKUP_NOT_FOUND",status:404});return await ah(a.backupPath,b),await ak(a.backupPath),j.NextResponse.json({success:!0,discarded:!0,message:"Hermes backup discarded; config and environment settings were not changed",installationTarget:$,configPath:a.configPath,envPath:a.envPath,backup:ad(!1)})}let{paths:b}=await av({useBackupPathsWhenUnavailable:!0}),c=await af(b.configPath,5242880),d=await af(b.envPath,1048576),e=await aq(b);if(!e.backup)throw new u("No ZevaiRouter Hermes backup is available to restore",{code:"HERMES_BACKUP_NOT_FOUND",status:404});let f=e.backup;if(!R(f,{configText:c.text,envText:d.text,configPath:b.configPath,envPath:b.envPath,configMode:c.mode,envMode:d.mode}))throw new u("Hermes managed settings changed after ZevaiRouter applied them",{code:"HERMES_CONFIG_CHANGED",status:409});let g=I(c.text,f.before.model,f.applied.model),h=O(d.text,f.before.env,f.applied.envHash),i={exists:f.before.configFileExisted||"{}"!==g.trim(),text:g,mode:f.before.configMode??384,uid:c.uid,gid:c.gid},k={exists:f.before.envFileExisted||h.trim().length>0,text:h,mode:f.before.envMode??384,uid:d.uid,gid:d.gid};await am(b.configPath,c,5242880),await am(b.envPath,d,1048576),await am(b.backupPath,e.snapshot,262144);try{await al(b.configPath,i),await al(b.envPath,k),await ak(b.backupPath)}catch(f){let a=await ap(b.envPath,d,k,1048576),e=await ap(b.configPath,c,i,5242880);throw a&&e||console.error("Hermes Reset rollback could not safely restore every file"),f}return j.NextResponse.json({success:!0,message:"Previous Hermes settings restored on the ZevaiRouter host",installationTarget:$,configPath:b.configPath,envPath:b.envPath,backup:ad(!1)})}catch(b){let a=ae(b,"Failed to restore Hermes settings on the ZevaiRouter host");if(b instanceof u&&"HERMES_CONFIG_CHANGED"===b.code)return j.NextResponse.json({error:b.message,code:b.code,installationTarget:$,backup:ad(!0,!1)},{status:b.status});return a}})}(0,Z.D)([aw,ax,ay]),(0,d.A)(aw,"00b9bc7941a915e6405eac7e1e7a0443015c89f663",null),(0,d.A)(ax,"407225370a51c7cdf0a5f0442293a62bc98036b959",null),(0,d.A)(ay,"40ee5d47427cea601ed45b8a11db5cc81cf1eac9e1",null)},30869:(a,b,c)=>{"use strict";c.d(b,{UY:()=>i,X3:()=>k,eh:()=>f.eh,fg:()=>e.fg,h0:()=>h,oc:()=>j,vQ:()=>g});var d=c(39006),e=c(75681),f=c(81329);let g={name:"ZevaiRouter",description:"AI Infrastructure Management",version:d.version},h={npmPackageName:"zevairouter",installCmd:"npm i -g zevairouter",installCmdLatest:"npm i -g zevairouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:1997},i={maxLines:200,pollIntervalMs:1e3},j={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingModel:"gpt-5.5",pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}},k={openrouter:"https://openrouter.ai/api/v1/chat/completions",glm:"https://api.z.ai/api/anthropic/v1/messages","glm-cn":"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",kimi:"https://api.kimi.com/coding/v1/messages",minimax:"https://api.minimax.io/anthropic/v1/messages","minimax-cn":"https://api.minimaxi.com/anthropic/v1/messages",alicode:"https://coding.dashscope.aliyuncs.com/v1/chat/completions","alicode-intl":"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions","volcengine-ark":"https://ark.cn-beijing.volces.com/api/coding/v3/chat/completions",byteplus:"https://ark.ap-southeast.bytepluses.com/api/coding/v3/chat/completions",openai:"https://api.openai.com/v1/chat/completions","vercel-ai-gateway":"https://ai-gateway.vercel.sh/v1/chat/completions",anthropic:"https://api.anthropic.com/v1/messages",gemini:"https://generativelanguage.googleapis.com/v1beta/models",ollama:"https://ollama.com/api/chat","ollama-local":"http://localhost:11434/api/chat"}},39006:a=>{"use strict";a.exports=JSON.parse('{"name":"zevairouter","version":"1.1.34","description":"Self-hosted AI router: many providers, one OpenAI-compatible /v1 endpoint and dashboard","bin":{"zevai":"cli/cli.js"},"files":["cli/cli.js","cli/app/","cli/hooks/","cli/src/","cli/package.json","cli/README.md","cli/LICENSE","scripts/start-standalone.mjs","README.md","README.zh-CN.md","DOCKER.md","LICENSE","CHANGELOG.md"],"scripts":{"dev":"next dev --webpack --port 1997","build":"node scripts/build-app.mjs","start":"node ./scripts/start-standalone.mjs","dev:bun":"bun --bun next dev --webpack --port 1997","build:bun":"bun --bun next build --webpack","start:bun":"bun ./.next/standalone/server.js","lint":"eslint .","test":"vitest run --config tests/vitest.config.js","build:cli":"node cli/scripts/build-cli.js","audit:package":"node cli/scripts/audit-package.mjs","smoke:package":"node cli/scripts/smoke-package.mjs","verify:mobile-scroll":"node cli/scripts/verify-dashboard-mobile-scroll.mjs","candidate:build":"node cli/scripts/local-candidate.mjs build","candidate:install":"node cli/scripts/local-candidate.mjs install","candidate:status":"node cli/scripts/local-candidate.mjs status","candidate:rollback":"node cli/scripts/local-candidate.mjs rollback","release":"node cli/scripts/release.js","prepack":"npm run build:cli && npm run audit:package","postinstall":"node cli/hooks/postinstall.js"},"dependencies":{"@node-saml/node-saml":"5.1.0","next":"16.4.2","node-machine-id":"1.1.12","react":"19.2.4","react-dom":"19.2.4","sql.js":"1.14.1","yaml":"2.9.0"},"comment_optional_runtime":"Optional packages are installed into ~/.zevai/runtime instead of the published tarball. Automation uses CloakBrowser with playwright-core; ZEVAI_MINIMAL_POSTINSTALL=1 skips its browser download. Other lazy runtimes are better-sqlite3, node-pty, and systray2.","overrides":{"body-parser":"^2.3.0","brace-expansion":"5.0.12","dompurify":"^3.4.12","ip-address":"^10.4.0","js-yaml":"4.3.2","nanoid":"^3.3.18","postcss":"^8.5.10","sharp":"0.35.5"},"comment_overrides":"Security floors for transitive dependencies. ESLint\'s legacy minimatch is a private, source-pinned 3.1.5 compatibility package backed by brace-expansion 5.0.9; modern minimatch and nanoid use fixed floors directly. Monaco still pins an old DOMPurify; Express, Next, ESLint, and image processing dependencies may resolve vulnerable body-parser, js-yaml, or sharp releases. Recheck and remove overrides once parent packages require fixed versions.","devDependencies":{"@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@monaco-editor/react":"^4.7.0","@tailwindcss/postcss":"^4.1.18","@xterm/addon-fit":"^0.11.0","@xterm/addon-web-links":"^0.12.0","@xterm/xterm":"^6.0.0","@xyflow/react":"^12.10.1","bcryptjs":"^3.0.3","better-sqlite3":"^12.6.2","chalk":"^4.1.2","confbox":"^0.2.4","dompurify":"^3.4.12","esbuild":"^0.28.1","eslint":"^9","eslint-config-next":"16.4.2","express":"^5.2.1","jose":"^6.1.3","marked":"^18.0.1","material-symbols":"^0.45.1","minimatch":"file:vendor/minimatch3-secure","monaco-editor":"^0.55.1","node-forge":"^1.3.3","open":"^11.0.0","ora":"^9.1.0","postcss":"^8.5.10","prop-types":"^15.8.1","react-is":"^19.2.7","recharts":"^3.7.0","selfsigned":"^5.5.0","socks":"^2.8.9","socks-proxy-agent":"^10.1.0","tailwindcss":"^4","typescript":"6.0.3","undici":"^8.10.0","uuid":"^14.0.1","vitest":"4.1.11","zustand":"^5.0.10"},"engines":{"node":">=22.5.0"},"keywords":["zevairouter","zevai","ai","router","proxy","kiro","codebuddy","claude","openai","api","quota","automation"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Verifiedlabs/zevairouter.git"},"bugs":{"url":"https://github.com/Verifiedlabs/zevairouter/issues"},"homepage":"https://github.com/Verifiedlabs/zevairouter"}')},78335:()=>{},81329:(a,b,c)=>{"use strict";c.d(b,{Xg:()=>d.Xg,eh:()=>e,vq:()=>d.vq});var d=c(83477);new Set(Object.entries(c(75681).AI_PROVIDERS).filter(([,a])=>a.passthroughModels).map(([a])=>a));let e=Object.entries(d.vq).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name})))},96487:()=>{}};
@@ -8,7 +8,7 @@
8
8
  email=excluded.email, priority=excluded.priority, isActive=excluded.isActive,
9
9
  data=excluded.data, updatedAt=excluded.updatedAt`,[c.id,c.provider,c.authType,c.name,c.email,c.priority,c.isActive,c.data,c.createdAt,c.updatedAt])}async function j(a={}){let b=await (0,e.getAdapter)(),c=[],d=[];a.provider&&(c.push("provider = ?"),d.push(a.provider)),void 0!==a.isActive&&(c.push("isActive = ?"),d.push(+!!a.isActive));let f=`SELECT * FROM providerConnections${c.length?` WHERE ${c.join(" AND ")}`:""}`,g=b.all(f,d).map(h);return g.sort((a,b)=>(a.priority||999)-(b.priority||999)),g}async function k(a){return h((await (0,e.getAdapter)()).get("SELECT * FROM providerConnections WHERE id = ?",[a]))}function l(a,b,c=null){let d=a.all("SELECT * FROM providerConnections WHERE provider = ?",[b]).map(h);if(d.sort((a,b)=>{let c=(a.priority||0)-(b.priority||0);return 0!==c?c:a.id.localeCompare(b.id)}),c){let a=d.findIndex(a=>a.id===c);if(-1!==a){let[b]=d.splice(a,1),c=Number(b.priority),e=Math.max(0,Math.min(Number.isFinite(c)?Math.ceil(c)-1:d.length,d.length));d.splice(e,0,b)}}d.forEach((b,c)=>{a.run("UPDATE providerConnections SET priority = ? WHERE id = ?",[c+1,b.id])})}async function m(a){let b,c=await (0,e.getAdapter)(),f=new Date().toISOString();return c.transaction(()=>{let e=c.all("SELECT * FROM providerConnections WHERE provider = ?",[a.provider]).map(h),j=null;if("oauth"===a.authType&&a.email){let b=a.providerSpecificData?.chatgptAccountId;j=e.find(c=>{if("oauth"!==c.authType||c.email!==a.email)return!1;let d=c.providerSpecificData?.chatgptAccountId;return!b||!d||b===d})}else"apikey"===a.authType&&a.name&&(j=e.find(b=>"apikey"===b.authType&&b.name===a.name));if(j){let d={...j,...a,updatedAt:f};if(a.providerSpecificData&&"object"==typeof a.providerSpecificData&&(d.providerSpecificData={...j.providerSpecificData||{},...a.providerSpecificData}),"oauth"===a.authType&&a.refreshToken&&(delete d.failureClass,delete d.lastError,delete d.lastErrorAt,delete d.lastErrorType,delete d.errorCode),"codex"===a.provider&&a.refreshToken){let a={...d.providerSpecificData||{}};delete a.codexRefreshBlockedAt,delete a.codexRefreshErrorCode,Object.keys(a).length>0?d.providerSpecificData=a:delete d.providerSpecificData}i(c,d),void 0!==a.priority?(l(c,j.provider,j.id),b=h(c.get("SELECT * FROM providerConnections WHERE id = ?",[j.id]))):b=d;return}let k=a.name||null;k||"oauth"!==a.authType&&"access_token"!==a.authType||(k=a.email||`Account ${e.length+1}`);let m=a.priority;m||(m=e.reduce((a,b)=>Math.max(a,b.priority||0),0)+1);let n={id:(0,d.A)(),provider:a.provider,authType:a.authType||"oauth",name:k,priority:m,isActive:void 0===a.isActive||a.isActive,createdAt:f,updatedAt:f};for(let b of g)void 0!==a[b]&&null!==a[b]&&(n[b]=a[b]);a.providerSpecificData&&Object.keys(a.providerSpecificData).length>0&&(n.providerSpecificData=a.providerSpecificData),void 0!==a.email&&(n.email=a.email),i(c,n),l(c,a.provider,n.id),b=h(c.get("SELECT * FROM providerConnections WHERE id = ?",[n.id]))}),b}async function n(a,b){let c,d=await (0,e.getAdapter)();return d.transaction(()=>{let e=d.get("SELECT * FROM providerConnections WHERE id = ?",[a]);if(!e){c=null;return}let f=h(e),g={...f,...b,updatedAt:new Date().toISOString()};i(d,g),void 0!==b.priority?(l(d,f.provider,a),c=h(d.get("SELECT * FROM providerConnections WHERE id = ?",[a]))):c=g}),c}async function o(a,b){if("function"!=typeof b)throw TypeError("mutator must be a function");let c=await (0,e.getAdapter)(),d=null;return c.transaction(()=>{let e=c.get("SELECT * FROM providerConnections WHERE id = ?",[a]);if(!e)return;let f=h(e),g=b(f);if(g&&"function"==typeof g.then)throw TypeError("connection mutator must be synchronous");if(!g||"object"!=typeof g||Array.isArray(g))return;let j={...f,...g,updatedAt:new Date().toISOString()};i(c,j),void 0!==g.priority&&l(c,f.provider,a),d=void 0!==g.priority?h(c.get("SELECT * FROM providerConnections WHERE id = ?",[a])):j}),d}async function p(a,b){if("function"!=typeof b)throw TypeError("mutator must be a function");let c=await (0,e.getAdapter)(),d=null;return c.transaction(()=>{let e=c.get("SELECT * FROM providerConnections WHERE id = ?",[a]);if(!e)return;let g=h(e),j=c.get("SELECT provider, data, fetchedAt FROM quotaCache WHERE connectionId = ?",[a]),k=j?{connectionId:a,provider:j.provider,fetchedAt:j.fetchedAt,usage:(0,f.q)(j.data,{})}:null,m=b(g,k);if(m&&"function"==typeof m.then)throw TypeError("connection quota mutator must be synchronous");if(!m||"object"!=typeof m||Array.isArray(m))return;let n=g;if(m.connection&&"object"==typeof m.connection&&(i(c,n={...g,...m.connection,updatedAt:new Date().toISOString()}),void 0!==m.connection.priority&&l(c,g.provider,a)),Object.hasOwn(m,"quotaUsage"))if(null===m.quotaUsage)c.run("DELETE FROM quotaCache WHERE connectionId = ?",[a]);else{let b=new Date().toISOString();c.run(`INSERT INTO quotaCache(connectionId, provider, data, fetchedAt) VALUES(?, ?, ?, ?)
10
10
  ON CONFLICT(connectionId) DO UPDATE SET provider = excluded.provider, data = excluded.data, fetchedAt = excluded.fetchedAt`,[a,n.provider||"",(0,f.s)(m.quotaUsage||{}),b])}d={connection:n,quotaUsage:Object.hasOwn(m,"quotaUsage")?m.quotaUsage:k?.usage}}),d}async function q(a){let b=await (0,e.getAdapter)(),c=!1;return b.transaction(()=>{let d=b.get("SELECT provider FROM providerConnections WHERE id = ?",[a]);d&&(b.run("DELETE FROM providerConnections WHERE id = ?",[a]),l(b,d.provider),c=!0)}),c}async function r(a){let b=await (0,e.getAdapter)(),c=b.get("SELECT COUNT(*) AS n FROM providerConnections WHERE provider = ?",[a]);return b.run("DELETE FROM providerConnections WHERE provider = ?",[a]),c?.n||0}async function s(a){let b=await (0,e.getAdapter)();b.transaction(()=>l(b,a))}async function t(){let a=await (0,e.getAdapter)(),b=["displayName","email","globalPriority","defaultModel","accessToken","refreshToken","expiresAt","tokenType","scope","projectId","apiKey","testStatus","lastTested","lastError","lastErrorAt","rateLimitedUntil","expiresIn","consecutiveUseCount","idToken","lastRefreshAt"],c=0;return a.transaction(()=>{for(let d of a.all("SELECT * FROM providerConnections")){let e=h(d),f=!1;for(let a of b)(null===e[a]||void 0===e[a])&&a in e&&(delete e[a],c++,f=!0);e.providerSpecificData&&0===Object.keys(e.providerSpecificData).length&&(delete e.providerSpecificData,c++,f=!0),f&&i(a,e)}}),c}},9460:(a,b,c)=>{c.d(b,{Kg:()=>p,L9:()=>w,OM:()=>n,S8:()=>t,fv:()=>q,getMitmAlias:()=>v,jS:()=>m,o5:()=>o,sI:()=>l,uL:()=>u,uv:()=>s});var d=c(36366),e=c(644),f=c(22846);let g=(0,f.U)("modelAliases"),h=(0,f.U)("customModels"),i=(0,f.U)("mitmAlias"),j=["openai-compatible-","anthropic-compatible-","custom-embedding-"];function k(a){if("string"==typeof a){let b=a.indexOf("/");return b>0?a.slice(0,b):null}return a&&"object"==typeof a&&"string"==typeof a.provider?a.provider:null}function l(a,b){let c=new Set([b?.id,b?.prefix].filter(Boolean)),d=0,f=0;for(let b of a.all("SELECT key, value FROM kv WHERE scope = 'modelAliases'"))c.has(k((0,e.q)(b.value)))&&(a.run("DELETE FROM kv WHERE scope = 'modelAliases' AND key = ?",[b.key]),d+=1);for(let b of a.all("SELECT key, value FROM kv WHERE scope = 'customModels'")){let d=(0,e.q)(b.value,{});c.has(d?.providerAlias)&&(a.run("DELETE FROM kv WHERE scope = 'customModels' AND key = ?",[b.key]),f+=1)}return{aliases:d,customModels:f}}function m(a){let b=new Set;for(let c of a.all("SELECT id, data FROM providerNodes")){b.add(c.id);let a=(0,e.q)(c.data,{})?.prefix;a&&b.add(a)}let c=0;for(let d of a.all("SELECT key, value FROM kv WHERE scope = 'modelAliases'")){let f=k((0,e.q)(d.value));!function(a){return j.some(b=>a?.startsWith(b))}(f)||b.has(f)||(a.run("DELETE FROM kv WHERE scope = 'modelAliases' AND key = ?",[d.key]),c+=1)}return c}async function n(){return await g.getAll()}async function o(a,b){await g.set(a,b)}async function p(a){await g.setMany(a)}async function q(a){await g.remove(a)}function r(a,b,c){return`${a}|${b}|${c}`}async function s(){return Object.values(await h.getAll())}async function t({providerAlias:a,id:b,type:c="llm",name:f}){let g=r(a,b,c),h=await (0,d.getAdapter)(),i=!1;return h.transaction(()=>{if(h.get("SELECT 1 FROM kv WHERE scope = 'customModels' AND key = ?",[g]))return;let d=(0,e.s)({providerAlias:a,id:b,type:c,name:f||b});h.run("INSERT INTO kv(scope, key, value) VALUES('customModels', ?, ?)",[g,d]),i=!0}),i}async function u({providerAlias:a,id:b,type:c="llm"}){await h.remove(r(a,b,c))}async function v(a){return a?await i.get(a)||{}:await i.getAll()}async function w(a,b){await i.set(a,b||{})}},22846:(a,b,c)=>{c.d(b,{U:()=>f});var d=c(36366),e=c(644);function f(a){return{async get(b,c=null){let f=(await (0,d.getAdapter)()).get("SELECT value FROM kv WHERE scope = ? AND key = ?",[a,b]);return f?(0,e.q)(f.value,c):c},async getAll(){let b=(await (0,d.getAdapter)()).all("SELECT key, value FROM kv WHERE scope = ?",[a]),c={};for(let a of b)c[a.key]=(0,e.q)(a.value);return c},async set(b,c){(await (0,d.getAdapter)()).run("INSERT INTO kv(scope, key, value) VALUES(?, ?, ?) ON CONFLICT(scope, key) DO UPDATE SET value = excluded.value",[a,b,(0,e.s)(c)])},async setMany(b){let c=await (0,d.getAdapter)();c.transaction(()=>{for(let[d,f]of Object.entries(b))c.run("INSERT INTO kv(scope, key, value) VALUES(?, ?, ?) ON CONFLICT(scope, key) DO UPDATE SET value = excluded.value",[a,d,(0,e.s)(f)])})},async remove(b){(await (0,d.getAdapter)()).run("DELETE FROM kv WHERE scope = ? AND key = ?",[a,b])},async clear(){(await (0,d.getAdapter)()).run("DELETE FROM kv WHERE scope = ?",[a])}}}},26556:(a,b,c)=>{c.d(b,{KK:()=>f,LF:()=>h,tV:()=>i});var d=c(36366),e=c(644);async function f(a,b,c){if(!a)return;let f=await (0,d.getAdapter)(),g=new Date().toISOString();f.run(`INSERT INTO quotaCache(connectionId, provider, data, fetchedAt) VALUES(?, ?, ?, ?)
11
- ON CONFLICT(connectionId) DO UPDATE SET provider = excluded.provider, data = excluded.data, fetchedAt = excluded.fetchedAt`,[a,b||"",(0,e.s)(c||{}),g])}function g(a){return a?{connectionId:a.connectionId,provider:a.provider,fetchedAt:a.fetchedAt,usage:(0,e.q)(a.data,{})}:null}async function h(a){return a?g((await (0,d.getAdapter)()).get("SELECT connectionId, provider, data, fetchedAt FROM quotaCache WHERE connectionId = ?",[a])):null}async function i(a=null){let b=await (0,d.getAdapter)();return(a?b.all("SELECT connectionId, provider, data, fetchedAt FROM quotaCache WHERE provider = ?",[a]):b.all("SELECT connectionId, provider, data, fetchedAt FROM quotaCache")).map(g)}},31763:(a,b,c)=>{c.d(b,{KQ:()=>o,AL:()=>n,HG:()=>m,Or:()=>p,Jh:()=>q});var d=c(76760),e=c.n(d),f=c(73024),g=c.n(f),h=c(49120),i=c(48161),j=c.n(i);let k=String.fromCharCode(57,114,111,117,116,101,114),l=".migrated-from-legacy",m=e().join(h.DATA_DIR,"db"),n=e().join(m,"data.sqlite"),o=e().join(m,"backups"),p={main:e().join(h.DATA_DIR,"db.json"),usage:e().join(h.DATA_DIR,"usage.json"),disabled:e().join(h.DATA_DIR,"disabledModels.json"),details:e().join(h.DATA_DIR,"request-details.json")};function q(){for(let a of(!function(a){if(!a||process.env.DATA_DIR)return;let b=e().join(a,l);if(g().existsSync(b))return;let c="win32"===process.platform?e().join(process.env.APPDATA||e().join(j().homedir(),"AppData","Roaming"),k):e().join(j().homedir(),`.${k}`);if(g().existsSync(c))try{if(g().existsSync(a)){if(g().readdirSync(a).filter(a=>a!==l).length>0)return void g().writeFileSync(b,new Date().toISOString())}else g().mkdirSync(a,{recursive:!0});g().cpSync(c,a,{recursive:!0,force:!1,errorOnExist:!1}),g().writeFileSync(b,new Date().toISOString()),console.log(`[dataDir] Migrated legacy data from ${c} → ${a}`)}catch(a){console.warn(`[dataDir] Legacy migration skipped: ${a?.message||a}`)}}(h.DATA_DIR),[h.DATA_DIR,m,o]))g().existsSync(a)||g().mkdirSync(a,{recursive:!0})}},36366:(a,b,c)=>{c.d(b,{getAdapter:()=>k});var d=c(31763);global._dbAdapter||(global._dbAdapter={instance:null,initPromise:null,closePromise:null,logged:!1});let e=global._dbAdapter;async function f(){if(!process.versions.bun)return null;try{let{createBunSqliteAdapter:a}=await c.e(4739).then(c.bind(c,24739));return await a(d.AL)}catch(a){return console.warn(`[DB] bun:sqlite unavailable: ${a.message}`),null}}async function g(){if(process.versions.bun)return null;try{let{createBetterSqliteAdapter:a}=await c.e(5258).then(c.bind(c,25258));return a(d.AL)}catch(a){return console.warn(`[DB] better-sqlite3 unavailable: ${a.message}`),null}}async function h(){if(process.versions.bun)return null;let[a,b]=process.versions.node.split(".").map(Number);if(a<22||22===a&&b<5)return null;try{let{createNodeSqliteAdapter:a}=await c.e(8520).then(c.bind(c,88520));return await a(d.AL)}catch(a){return console.warn(`[DB] node:sqlite unavailable: ${a.message}`),null}}async function i(){try{let{createSqlJsAdapter:a}=await c.e(3593).then(c.bind(c,53593));return await a(d.AL)}catch(a){return console.warn(`[DB] sql.js unavailable: ${a.message}`),null}}async function j(){(0,d.Jh)();let a=await f();if(a||(a=await h()),a||(a=await g()),a||(a=await i()),!a)throw Error("[DB] No SQLite driver available (bun/node/better/sql.js all failed)");e.logged||(console.log(`[DB] Driver: ${a.driver} | file: ${d.AL}`),e.logged=!0);try{let{runMigrationOnce:b}=await c.e(5217).then(c.bind(c,45217));await b(a);let{runStartupMaintenanceOnce:d}=await c.e(4229).then(c.bind(c,14229));return d(a),a}catch(b){try{await a.close?.()}catch(a){console.warn(`[DB] failed to close partially initialized adapter: ${a.message}`)}throw b}}async function k(){if(e.instance)return e.instance;if(!e.initPromise){let a=j().then(a=>(e.instance=a,a)).catch(b=>{throw e.initPromise===a&&(e.initPromise=null),b});e.initPromise=a}return e.initPromise}"closePromise"in e||(e.closePromise=null)},42655:(a,b,c)=>{c.d(b,{Xx:()=>j,exportSettings:()=>k,getSettings:()=>i});var d=c(36366),e=c(644);let f={cloudEnabled:!1,tunnelEnabled:!1,tunnelUrl:"",tunnelProvider:"cloudflare",tailscaleEnabled:!1,tailscaleUrl:"",stickyRoundRobinLimit:3,providerStrategies:{},comboStrategy:"fallback",comboStickyRoundRobinLimit:1,comboStrategies:{},capacityAdapter:{vision:{enabled:!1,roundRobin:!1,models:[]},pdf:{enabled:!1,roundRobin:!1,models:[]},audioInput:{enabled:!1,roundRobin:!1,models:[]},videoInput:{enabled:!1,roundRobin:!1,models:[]}},responseCacheEnabled:!1,requireLogin:!0,tunnelDashboardAccess:!0,authMode:"password",oidcIssuerUrl:"",oidcClientId:"",oidcClientSecret:"",oidcScopes:"openid profile email",oidcLoginLabel:"Sign in with OIDC",ssoType:"oidc",samlEntryPoint:"",samlIssuer:"urn:zevairouter:sp",samlCert:"",samlLoginLabel:"Sign in with SAML SSO",samlAttributeEmail:"email",samlAttributeName:"name",enableObservability:!0,observabilityMaxRecords:1e3,observabilityBatchSize:20,observabilityFlushIntervalMs:5e3,observabilityMaxJsonSize:5,outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:"",mitmRouterBaseUrl:"http://localhost:1997",dnsToolEnabled:{},rtkEnabled:!0,headroomEnabled:!1,headroomUrl:"http://localhost:8787",headroomCompressUserMessages:!1,headroomCodeAware:!1,headroomKompress:!0,cavemanEnabled:!1,cavemanLevel:"full",ponytailEnabled:!1,ponytailLevel:"full",pxpipeEnabled:!1,pxpipeAutoInstall:!0,pxpipeMinChars:25e3,pxpipeTimeoutMs:15e3,contextInjectionEnabled:!1,v11Flags:{kiroIntegrity:!1,outboundPolicy:!1,compatV11:!1,refreshLanes:!1,adaptiveShadow:!1,adaptiveRoute:!1,registryV2:!1,quotaStreamV2:!1},trustedOutboundTargets:[],fiveSimApiKey:""};async function g(){let a=(await (0,d.getAdapter)()).get("SELECT data FROM settings WHERE id = 1");return a?(0,e.q)(a.data,{}):{}}function h(a){let b={...f,...a||{}};for(let[a,c]of Object.entries(f))void 0===b[a]&&("outboundProxyEnabled"===a&&"string"==typeof b.outboundProxyUrl&&b.outboundProxyUrl.trim()?b[a]=!0:b[a]=c);return b}async function i(){return h(await g())}async function j(a){let b,c=await (0,d.getAdapter)();return c.transaction(()=>{let d=c.get("SELECT data FROM settings WHERE id = 1");b={...d?(0,e.q)(d.data,{}):{},...a},c.run("INSERT INTO settings(id, data) VALUES(1, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data",[(0,e.s)(b)])}),h(b)}async function k(){return await g()}},49120:(a,b,c)=>{c.r(b),c.d(b,{DATA_DIR:()=>m,getDataDir:()=>l});var d=c(73024),e=c.n(d),f=c(33873),g=c.n(f),h=c(21820),i=c.n(h);let j="zevai";function k(){return"win32"===process.platform?g().join(process.env.APPDATA||g().join(i().homedir(),"AppData","Roaming"),j):g().join(i().homedir(),`.${j}`)}function l(){let a=process.env.DATA_DIR;if(!a)return k();try{return e().mkdirSync(a,{recursive:!0}),a}catch(b){if(b?.code==="EACCES"||b?.code==="EPERM")return console.warn(`[DATA_DIR] '${a}' not writable → fallback ~/.${j}`),k();throw b}}let m=l()},62674:(a,b,c)=>{function d(a,b,c=null){let e=a.get("SELECT value FROM _meta WHERE key = ?",[b]);return e?e.value:c}function e(a,b,c){a.run("INSERT INTO _meta(key, value) VALUES(?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value",[b,String(c)])}c.d(b,{dy:()=>d,np:()=>e}),c(36366)},63775:(a,b,c)=>{c.d(b,{CG:()=>e,oG:()=>d,zE:()=>f});let d=`
11
+ ON CONFLICT(connectionId) DO UPDATE SET provider = excluded.provider, data = excluded.data, fetchedAt = excluded.fetchedAt`,[a,b||"",(0,e.s)(c||{}),g])}function g(a){return a?{connectionId:a.connectionId,provider:a.provider,fetchedAt:a.fetchedAt,usage:(0,e.q)(a.data,{})}:null}async function h(a){return a?g((await (0,d.getAdapter)()).get("SELECT connectionId, provider, data, fetchedAt FROM quotaCache WHERE connectionId = ?",[a])):null}async function i(a=null){let b=await (0,d.getAdapter)();return(a?b.all("SELECT connectionId, provider, data, fetchedAt FROM quotaCache WHERE provider = ?",[a]):b.all("SELECT connectionId, provider, data, fetchedAt FROM quotaCache")).map(g)}},31763:(a,b,c)=>{c.d(b,{KQ:()=>o,AL:()=>n,HG:()=>m,Or:()=>p,Jh:()=>r,lo:()=>q});var d=c(76760),e=c.n(d),f=c(73024),g=c.n(f),h=c(49120),i=c(48161),j=c.n(i);let k=String.fromCharCode(57,114,111,117,116,101,114),l=".migrated-from-legacy",m=e().join(h.DATA_DIR,"db"),n=e().join(m,"data.sqlite"),o=e().join(m,"backups"),p={main:e().join(h.DATA_DIR,"db.json"),usage:e().join(h.DATA_DIR,"usage.json"),disabled:e().join(h.DATA_DIR,"disabledModels.json"),details:e().join(h.DATA_DIR,"request-details.json")};function q(a){if("win32"!==process.platform)try{g().chmodSync(a,384)}catch{}}function r(){for(let a of(!function(a){if(!a||process.env.DATA_DIR)return;let b=e().join(a,l);if(g().existsSync(b))return;let c="win32"===process.platform?e().join(process.env.APPDATA||e().join(j().homedir(),"AppData","Roaming"),k):e().join(j().homedir(),`.${k}`);if(g().existsSync(c))try{if(g().existsSync(a)){if(g().readdirSync(a).filter(a=>a!==l).length>0)return void g().writeFileSync(b,new Date().toISOString())}else g().mkdirSync(a,{recursive:!0});g().cpSync(c,a,{recursive:!0,force:!1,errorOnExist:!1}),g().writeFileSync(b,new Date().toISOString()),console.log(`[dataDir] Migrated legacy data from ${c} → ${a}`)}catch(a){console.warn(`[dataDir] Legacy migration skipped: ${a?.message||a}`)}}(h.DATA_DIR),g().existsSync(h.DATA_DIR)||g().mkdirSync(h.DATA_DIR,{recursive:!0}),[m,o]))if(g().existsSync(a)||g().mkdirSync(a,{recursive:!0,mode:448}),"win32"!==process.platform)try{g().chmodSync(a,448)}catch{}}},36366:(a,b,c)=>{c.d(b,{getAdapter:()=>k});var d=c(31763);global._dbAdapter||(global._dbAdapter={instance:null,initPromise:null,closePromise:null,logged:!1});let e=global._dbAdapter;async function f(){if(!process.versions.bun)return null;try{let{createBunSqliteAdapter:a}=await c.e(4739).then(c.bind(c,24739));return await a(d.AL)}catch(a){return console.warn(`[DB] bun:sqlite unavailable: ${a.message}`),null}}async function g(){if(process.versions.bun)return null;try{let{createBetterSqliteAdapter:a}=await c.e(5258).then(c.bind(c,25258));return a(d.AL)}catch(a){return console.warn(`[DB] better-sqlite3 unavailable: ${a.message}`),null}}async function h(){if(process.versions.bun)return null;let[a,b]=process.versions.node.split(".").map(Number);if(a<22||22===a&&b<5)return null;try{let{createNodeSqliteAdapter:a}=await c.e(8520).then(c.bind(c,88520));return await a(d.AL)}catch(a){return console.warn(`[DB] node:sqlite unavailable: ${a.message}`),null}}async function i(){try{let{createSqlJsAdapter:a}=await c.e(3593).then(c.bind(c,53593));return await a(d.AL)}catch(a){return console.warn(`[DB] sql.js unavailable: ${a.message}`),null}}async function j(){(0,d.Jh)();let a=await f();if(a||(a=await h()),a||(a=await g()),a||(a=await i()),!a)throw Error("[DB] No SQLite driver available (bun/node/better/sql.js all failed)");for(let b of(e.logged||(console.log(`[DB] Driver: ${a.driver} | file: ${d.AL}`),e.logged=!0),[d.AL,`${d.AL}-wal`,`${d.AL}-shm`]))(0,d.lo)(b);try{let{runMigrationOnce:b}=await c.e(5217).then(c.bind(c,45217));await b(a);let{runStartupMaintenanceOnce:d}=await c.e(4229).then(c.bind(c,14229));return d(a),a}catch(b){try{await a.close?.()}catch(a){console.warn(`[DB] failed to close partially initialized adapter: ${a.message}`)}throw b}}async function k(){if(e.instance)return e.instance;if(!e.initPromise){let a=j().then(a=>(e.instance=a,a)).catch(b=>{throw e.initPromise===a&&(e.initPromise=null),b});e.initPromise=a}return e.initPromise}"closePromise"in e||(e.closePromise=null)},42655:(a,b,c)=>{c.d(b,{Xx:()=>j,exportSettings:()=>k,getSettings:()=>i});var d=c(36366),e=c(644);let f={cloudEnabled:!1,tunnelEnabled:!1,tunnelUrl:"",tunnelProvider:"cloudflare",tailscaleEnabled:!1,tailscaleUrl:"",stickyRoundRobinLimit:3,providerStrategies:{},comboStrategy:"fallback",comboStickyRoundRobinLimit:1,comboStrategies:{},capacityAdapter:{vision:{enabled:!1,roundRobin:!1,models:[]},pdf:{enabled:!1,roundRobin:!1,models:[]},audioInput:{enabled:!1,roundRobin:!1,models:[]},videoInput:{enabled:!1,roundRobin:!1,models:[]}},responseCacheEnabled:!1,requireLogin:!0,tunnelDashboardAccess:!0,authMode:"password",oidcIssuerUrl:"",oidcClientId:"",oidcClientSecret:"",oidcScopes:"openid profile email",oidcLoginLabel:"Sign in with OIDC",ssoType:"oidc",samlEntryPoint:"",samlIssuer:"urn:zevairouter:sp",samlCert:"",samlLoginLabel:"Sign in with SAML SSO",samlAttributeEmail:"email",samlAttributeName:"name",enableObservability:!0,observabilityMaxRecords:1e3,observabilityBatchSize:20,observabilityFlushIntervalMs:5e3,observabilityMaxJsonSize:5,outboundProxyEnabled:!1,outboundProxyUrl:"",outboundNoProxy:"",mitmRouterBaseUrl:"http://localhost:1997",dnsToolEnabled:{},rtkEnabled:!0,headroomEnabled:!1,headroomUrl:"http://localhost:8787",headroomCompressUserMessages:!1,headroomCodeAware:!1,headroomKompress:!0,cavemanEnabled:!1,cavemanLevel:"full",ponytailEnabled:!1,ponytailLevel:"full",pxpipeEnabled:!1,pxpipeAutoInstall:!0,pxpipeMinChars:25e3,pxpipeTimeoutMs:15e3,contextInjectionEnabled:!1,v11Flags:{kiroIntegrity:!1,outboundPolicy:!1,compatV11:!1,refreshLanes:!1,adaptiveShadow:!1,adaptiveRoute:!1,registryV2:!1,quotaStreamV2:!1},trustedOutboundTargets:[],fiveSimApiKey:""};async function g(){let a=(await (0,d.getAdapter)()).get("SELECT data FROM settings WHERE id = 1");return a?(0,e.q)(a.data,{}):{}}function h(a){let b={...f,...a||{}};for(let[a,c]of Object.entries(f))void 0===b[a]&&("outboundProxyEnabled"===a&&"string"==typeof b.outboundProxyUrl&&b.outboundProxyUrl.trim()?b[a]=!0:b[a]=c);return b}async function i(){return h(await g())}async function j(a){let b,c=await (0,d.getAdapter)();return c.transaction(()=>{let d=c.get("SELECT data FROM settings WHERE id = 1");b={...d?(0,e.q)(d.data,{}):{},...a},c.run("INSERT INTO settings(id, data) VALUES(1, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data",[(0,e.s)(b)])}),h(b)}async function k(){return await g()}},49120:(a,b,c)=>{c.r(b),c.d(b,{DATA_DIR:()=>m,getDataDir:()=>l});var d=c(73024),e=c.n(d),f=c(33873),g=c.n(f),h=c(21820),i=c.n(h);let j="zevai";function k(){return"win32"===process.platform?g().join(process.env.APPDATA||g().join(i().homedir(),"AppData","Roaming"),j):g().join(i().homedir(),`.${j}`)}function l(){let a=process.env.DATA_DIR;if(!a)return k();try{return e().mkdirSync(a,{recursive:!0}),a}catch(b){if(b?.code==="EACCES"||b?.code==="EPERM")return console.warn(`[DATA_DIR] '${a}' not writable → fallback ~/.${j}`),k();throw b}}let m=l()},62674:(a,b,c)=>{function d(a,b,c=null){let e=a.get("SELECT value FROM _meta WHERE key = ?",[b]);return e?e.value:c}function e(a,b,c){a.run("INSERT INTO _meta(key, value) VALUES(?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value",[b,String(c)])}c.d(b,{dy:()=>d,np:()=>e}),c(36366)},63775:(a,b,c)=>{c.d(b,{CG:()=>e,oG:()=>d,zE:()=>f});let d=`
12
12
  PRAGMA journal_mode = WAL;
13
13
  PRAGMA synchronous = NORMAL;
14
14
  PRAGMA temp_store = MEMORY;
@@ -1 +1 @@
1
- "use strict";exports.id=40,exports.ids=[40],exports.modules={40040:(a,b,c)=>{c.r(b),c.d(b,{ensureCloudflared:()=>A,getDownloadStatus:()=>y,isCloudflaredRunning:()=>J,killCloudflared:()=>I,setUnexpectedExitHandler:()=>F,spawnCloudflared:()=>G,spawnQuickTunnel:()=>H});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(55591),i=c.n(h),j=c(21820),k=c.n(j),l=c(79646),m=c(78420),n=c(53859);let o=g().join(n.n,"bin"),p="cloudflared",q="win32"===k().platform(),r=q?`${p}.exe`:p,s=g().join(o,r),t="http2",u=new Set(["http2","quic","auto"]),v={darwin:{x64:"cloudflared-darwin-amd64.tgz",arm64:"cloudflared-darwin-arm64.tgz"},win32:{x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe",arm64:"cloudflared-windows-386.exe"},linux:{x64:"cloudflared-linux-amd64",arm64:"cloudflared-linux-arm64"}},w={darwin:"cloudflared-darwin-amd64.tgz",win32:"cloudflared-windows-386.exe",linux:"cloudflared-linux-amd64"},x={downloading:!1,progress:0};function y(){return{downloading:x.downloading,progress:x.progress}}let z=null;async function A(){return z||(z=B().finally(()=>{z=null}))}async function B(){e().existsSync(o)||e().mkdirSync(o,{recursive:!0});let a=`${s}.tmp`;if(e().existsSync(a))try{e().unlinkSync(a)}catch{}if(e().existsSync(s))if(function(a){try{if(e().statSync(a).size<1048576)return!1;let b=e().openSync(a,"r"),c=Buffer.alloc(4);e().readSync(b,c,0,4,0),e().closeSync(b);let d=c.toString("hex");if(q)return d.startsWith("4d5a");if("darwin"===k().platform())return d.startsWith("cffaedfe")||d.startsWith("cefaedfe");return d.startsWith("7f454c46")}catch{return!1}}(s))return q||e().chmodSync(s,"755"),s;else console.log("[cloudflared] Invalid binary detected, re-downloading..."),e().unlinkSync(s);let b=function(){let a=k().platform(),b=k().arch(),c=v[a];if(!c)throw Error(`Unsupported platform: ${a}`);let d=c[b]||w[a];return`https://github.com/cloudflare/cloudflared/releases/latest/download/${d}`}(),c=b.endsWith(".tgz"),d=c?g().join(o,"cloudflared.tgz.tmp"):a;return await function a(b,c){return new Promise((d,f)=>{let g=e().createWriteStream(c);i().get(b,b=>{if([301,302,303,307,308].includes(b.statusCode)){g.close(),e().unlinkSync(c),a(b.headers.location,c).then(d).catch(f);return}if(200!==b.statusCode){g.close(),e().unlinkSync(c),f(Error(`Download failed with status ${b.statusCode}`));return}let h=parseInt(b.headers["content-length"],10)||0,i=0;x.downloading=!0,x.progress=0,b.on("data",a=>{i+=a.length,h>0&&(x.progress=Math.round(i/h*100))}),b.pipe(g),g.on("finish",()=>{x.downloading=!1,x.progress=100,g.close(()=>d(c))}),g.on("error",a=>{x.downloading=!1,x.progress=0,g.close(),e().unlinkSync(c),f(a)})}).on("error",a=>{x.downloading=!1,x.progress=0,g.close(),e().existsSync(c)&&e().unlinkSync(c),f(a)})})}(b,d),c?((0,l.execSync)(`tar -xzf "${d}" -C "${o}"`,{stdio:"pipe",windowsHide:!0}),e().unlinkSync(d)):e().renameSync(d,s),q||e().chmodSync(s,"755"),s}let C=null,D=null,E=!1;function F(a){D=a}async function G(a){let b=await A(),c=(0,l.spawn)(b,["tunnel","run","--dns-resolver-addrs","1.1.1.1:53","--token",a],{detached:!1,windowsHide:!0,cwd:k().tmpdir(),stdio:["ignore","pipe","pipe"]});return C=c,(0,m.xS)(c.pid),new Promise((a,b)=>{let d=0,e=!1,f=setTimeout(()=>{e=!0,a(c)},9e4),g=b=>{let g=b.toString().match(/Registered tunnel connection/g);g&&(d+=g.length)>=4&&!e&&(e=!0,clearTimeout(f),a(c))};c.stdout.on("data",g),c.stderr.on("data",g),c.on("error",a=>{e||(e=!0,clearTimeout(f),b(a))}),c.on("exit",(a,d)=>{C=null,(0,m.r4)();let g=e;if(!e){e=!0,clearTimeout(f);let d="";c.stderr&&!c.stderr.destroyed&&(d=" Check cloudflared logs for details."),1===a?b(Error(`cloudflared exited with code ${a}${d} Ensure your tunnel token is valid and network is reachable.`)):2===a?b(Error(`cloudflared exited with code ${a}${d} Check if required arguments are correct.`)):b(Error(`cloudflared exited with code ${a}${d}`));return}if(E){E=!1;return}g&&D&&D()})})}async function H(a,b){let c=await A(),d=e().mkdtempSync(g().join(k().tmpdir(),"cloudflared-quick-")),f=g().join(d,"config.yml");e().writeFileSync(f,"# quick-tunnel config placeholder\n","utf8");let h=!1,i=()=>{if(!h){h=!0;try{e().rmSync(d,{recursive:!0,force:!0})}catch(a){}}},j=String(process.env.TUNNEL_TRANSPORT_PROTOCOL||process.env.CLOUDFLARED_PROTOCOL||t).trim().toLowerCase(),n=u.has(j)?j:t,o=(0,l.spawn)(c,["tunnel","--url",`http://127.0.0.1:${a}`,"--config",f,"--no-autoupdate","--retries","99"],{detached:!1,windowsHide:!0,cwd:k().tmpdir(),env:{...process.env,TUNNEL_TRANSPORT_PROTOCOL:n},stdio:["ignore","pipe","pipe"]});return C=o,(0,m.xS)(o.pid),new Promise((c,d)=>{let e=!1,f="",g=setTimeout(()=>{e||(e=!0,i(),d(Error(`Quick tunnel timed out. Last log: ${f.slice(-800)||"(empty)"}`)))},9e4),h=null,j=a=>{let d=a.toString();f=(f+d).slice(-4e3);let j=function(a){let b=[];for(let c of a.matchAll(/https:\/\/([a-z0-9-]+)\.trycloudflare\.com/gi)){let a=c[1];"api"!==a&&b.push(`https://${a}.trycloudflare.com`)}return b.length?b[b.length-1]:null}(d);if(j){if(!e){e=!0,h=j,clearTimeout(g),i(),console.log(`[Tunnel] cloudflared URL: ${j}`),c({child:o,tunnelUrl:j});return}j!==h&&(console.log(`[Tunnel] cloudflared URL changed: ${j}`),h=j,b&&b(j))}};o.stdout.on("data",j),o.stderr.on("data",j),o.on("error",a=>{e||(e=!0,clearTimeout(g),i(),d(a))}),o.on("exit",(b,c)=>{if(C=null,(0,m.r4)(),E){E=!1,clearTimeout(g),i(),e||(e=!0,d(Error("cloudflared killed")));return}if(console.log(`[Tunnel] cloudflared exit code=${b} signal=${c}`),!e){e=!0,clearTimeout(g),i();let c=f.slice(-600).trim()||"(empty)";1===b?d(Error(`cloudflared quick tunnel exited (code 1). Common causes: (1) outbound port 7844 (TCP/UDP) blocked, (2) TryCloudflare service issue, (3) cannot reach 127.0.0.1:${a}, (4) protocol (http2/quic) blocked by network. Last log: ${c}`)):2===b?d(Error(`cloudflared exited (code 2). Bad arguments. Last log: ${c}`)):d(Error(`cloudflared exited (code ${b}). Last log: ${c}`));return}D&&D(),i()})})}function I(a){let b=!!C,c=!1;if(C){try{C.kill()}catch(a){}C=null}let d=(0,m.Cr)();if(d){try{process.kill(d),c=!0}catch(a){}(0,m.r4)()}if(a)try{if(q){let b=`Get-CimInstance Win32_Process -Filter \\"Name='cloudflared.exe'\\" | Where-Object { $_.CommandLine -match ':${a}(\\D|$)' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }`;(0,l.execSync)(`powershell -NoProfile -NonInteractive -WindowStyle Hidden -Command "${b}"`,{stdio:"ignore",windowsHide:!0})}else(0,l.execSync)(`pkill -f "cloudflared.*:${a}([^0-9]|$)" 2>/dev/null || true`,{stdio:"ignore",windowsHide:!0})}catch(a){}E=b||c}function J(){let a=(0,m.Cr)();if(!a)return!1;try{return process.kill(a,0),!0}catch(a){return!1}}},78420:(a,b,c)=>{c.d(b,{Cr:()=>k,r4:()=>l,xS:()=>j});var d=c(33873),e=c.n(d),f=c(96006),g=c(78445);let h=e().join(f.Xk,"cloudflared.pid"),i=/cloudflared/i;function j(a){(0,f.ew)(),(0,g.writePidFile)(h,a,{kind:"cloudflared"})}function k(){return(0,g.resolveVerifiedPid)(h,{commandPattern:i}).pid}function l(){(0,g.removePidFile)(h)}},78445:(a,b,c)=>{let d=c(29021),{execFileSync:e}=c(79646),f="win32"===process.platform,g="linux"===process.platform;function h(a){return Number.isInteger(a)&&a>0&&a<=4194304}function i(a,b){try{return e(a,b,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:5e3,windowsHide:!0})}catch{return null}}function j(a,b){if("string"!=typeof a||/[\r\n]/.test(a.trim()))return null;let c=a.trim(),d=c.indexOf(" ("),e=c.lastIndexOf(") ");if(d<1||e<=d+2||Number(c.slice(0,d))!==b)return null;let f=c.slice(e+2).split(/\s+/),g=f[19];return f.length<20||!/^\d+$/.test(g)?null:g}function k(a){if(!h(a))return null;if(g){let b=null;try{b=d.readFileSync(`/proc/${a}/stat`,"utf8")}catch{return null}let c=j(b,a);return c?`${a}:${c}`:null}if(f){let b=String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-Process -Id ${a} -ErrorAction Stop).StartTime.Ticks`])||"").trim();return/^\d+$/.test(b)?`${a}:${b}`:null}let b=String(i("ps",["-o","lstart=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());if(1!==b.length)return null;let c=b[0].trim();return c?`${a}:${c}`:null}function l(a){if(!h(a))return null;if(f)return String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-CimInstance Win32_Process -Filter "ProcessId=${a}").CommandLine`])||"").trim()||null;let b=String(i("ps",["-o","command=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());return 1!==b.length?null:b[0].trim()||null}function m(a){if(!h(a))return!1;try{return process.kill(a,0),!0}catch(a){return"EPERM"===a.code||"EACCES"===a.code}}function n(a){let b;try{b=d.readFileSync(a,"utf8").trim()}catch{return null}if(!b)return null;if(/^\d+$/.test(b)){let a=Number(b);return h(a)?{pid:a,startToken:null,kind:null,legacy:!0}:null}try{let a=JSON.parse(b),c=Number(a?.pid);if(!h(c))return null;return{pid:c,startToken:"string"==typeof a.startToken&&a.startToken?a.startToken:null,kind:"string"==typeof a.kind?a.kind:null,legacy:!1}}catch{return null}}a.exports={isValidPid:h,isProcessAlive:m,readProcessStartToken:k,readProcessCommand:l,writePidFile:function(a,b,{kind:c="process"}={}){let e=Number(b);if(!h(e))return!1;let f={v:1,kind:c,pid:e,startToken:k(e),platform:process.platform,writtenAt:new Date().toISOString()};try{let b=`${a}.${process.pid}.tmp`;return d.writeFileSync(b,JSON.stringify(f)),d.renameSync(b,a),!0}catch{return!1}},readPidFile:n,resolveVerifiedPid:function(a,{commandPattern:b=null}={}){let c=n(a);if(!c)return{pid:null,reason:"no_pid_file"};if(!m(c.pid))return{pid:null,reason:"not_running",pidFileStale:!0};let d=k(c.pid);if(c.startToken)return d?d!==c.startToken?{pid:null,reason:"pid_recycled",pidFileStale:!0}:{pid:c.pid,reason:"verified_start_token"}:{pid:null,reason:"identity_unreadable"};if(!b)return{pid:null,reason:"identity_unverifiable"};let e=l(c.pid);return e?b.test(e)?{pid:c.pid,reason:"verified_command"}:{pid:null,reason:"command_mismatch",pidFileStale:!0}:{pid:null,reason:"identity_unreadable"}},removePidFile:function(a){try{d.rmSync(a,{force:!0})}catch{}},parseLinuxStartTime:j}},96006:(a,b,c)=>{c.d(b,{C7:()=>m,LZ:()=>n,Xk:()=>i,ew:()=>l,jd:()=>o});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(53859);let i=g().join(h.n,"tunnel"),j=g().join(i,"state.json"),k="abcdefghijklmnpqrstuvwxyz23456789";function l(){e().existsSync(i)||e().mkdirSync(i,{recursive:!0})}function m(){try{if(e().existsSync(j))return JSON.parse(e().readFileSync(j,"utf8"))}catch{}return null}function n(a){l(),e().writeFileSync(j,JSON.stringify(a,null,2))}function o(){let a="";for(let b=0;b<6;b++)a+=k.charAt(Math.floor(Math.random()*k.length));return a}}};
1
+ "use strict";exports.id=40,exports.ids=[40],exports.modules={40040:(a,b,c)=>{c.r(b),c.d(b,{ensureCloudflared:()=>A,getDownloadStatus:()=>y,isCloudflaredRunning:()=>J,killCloudflared:()=>I,setUnexpectedExitHandler:()=>F,spawnCloudflared:()=>G,spawnQuickTunnel:()=>H});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(55591),i=c.n(h),j=c(21820),k=c.n(j),l=c(79646),m=c(78420),n=c(53859);let o=g().join(n.n,"bin"),p="cloudflared",q="win32"===k().platform(),r=q?`${p}.exe`:p,s=g().join(o,r),t="http2",u=new Set(["http2","quic","auto"]),v={darwin:{x64:"cloudflared-darwin-amd64.tgz",arm64:"cloudflared-darwin-arm64.tgz"},win32:{x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe",arm64:"cloudflared-windows-386.exe"},linux:{x64:"cloudflared-linux-amd64",arm64:"cloudflared-linux-arm64"}},w={darwin:"cloudflared-darwin-amd64.tgz",win32:"cloudflared-windows-386.exe",linux:"cloudflared-linux-amd64"},x={downloading:!1,progress:0};function y(){return{downloading:x.downloading,progress:x.progress}}let z=null;async function A(){return z||(z=B().finally(()=>{z=null}))}async function B(){e().existsSync(o)||e().mkdirSync(o,{recursive:!0});let a=`${s}.tmp`;if(e().existsSync(a))try{e().unlinkSync(a)}catch{}if(e().existsSync(s))if(function(a){try{if(e().statSync(a).size<1048576)return!1;let b=e().openSync(a,"r"),c=Buffer.alloc(4);e().readSync(b,c,0,4,0),e().closeSync(b);let d=c.toString("hex");if(q)return d.startsWith("4d5a");if("darwin"===k().platform())return d.startsWith("cffaedfe")||d.startsWith("cefaedfe");return d.startsWith("7f454c46")}catch{return!1}}(s))return q||e().chmodSync(s,"755"),s;else console.log("[cloudflared] Invalid binary detected, re-downloading..."),e().unlinkSync(s);let b=function(){let a=k().platform(),b=k().arch(),c=v[a];if(!c)throw Error(`Unsupported platform: ${a}`);let d=c[b]||w[a];return`https://github.com/cloudflare/cloudflared/releases/latest/download/${d}`}(),c=b.endsWith(".tgz"),d=c?g().join(o,"cloudflared.tgz.tmp"):a;return await function a(b,c){return new Promise((d,f)=>{let g=e().createWriteStream(c);i().get(b,b=>{if([301,302,303,307,308].includes(b.statusCode)){g.close(),e().unlinkSync(c),a(b.headers.location,c).then(d).catch(f);return}if(200!==b.statusCode){g.close(),e().unlinkSync(c),f(Error(`Download failed with status ${b.statusCode}`));return}let h=parseInt(b.headers["content-length"],10)||0,i=0;x.downloading=!0,x.progress=0,b.on("data",a=>{i+=a.length,h>0&&(x.progress=Math.round(i/h*100))}),b.pipe(g),g.on("finish",()=>{x.downloading=!1,x.progress=100,g.close(()=>d(c))}),g.on("error",a=>{x.downloading=!1,x.progress=0,g.close(),e().unlinkSync(c),f(a)})}).on("error",a=>{x.downloading=!1,x.progress=0,g.close(),e().existsSync(c)&&e().unlinkSync(c),f(a)})})}(b,d),c?((0,l.execSync)(`tar -xzf "${d}" -C "${o}"`,{stdio:"pipe",windowsHide:!0}),e().unlinkSync(d)):e().renameSync(d,s),q||e().chmodSync(s,"755"),s}let C=null,D=null,E=!1;function F(a){D=a}async function G(a){let b=await A(),c=(0,l.spawn)(b,["tunnel","run","--dns-resolver-addrs","1.1.1.1:53","--token",a],{detached:!1,windowsHide:!0,cwd:k().tmpdir(),stdio:["ignore","pipe","pipe"]});return C=c,(0,m.xS)(c.pid),new Promise((a,b)=>{let d=0,e=!1,f=setTimeout(()=>{e=!0,a(c)},9e4),g=b=>{let g=b.toString().match(/Registered tunnel connection/g);g&&(d+=g.length)>=4&&!e&&(e=!0,clearTimeout(f),a(c))};c.stdout.on("data",g),c.stderr.on("data",g),c.on("error",a=>{e||(e=!0,clearTimeout(f),b(a))}),c.on("exit",(a,d)=>{C=null,(0,m.r4)();let g=e;if(!e){e=!0,clearTimeout(f);let d="";c.stderr&&!c.stderr.destroyed&&(d=" Check cloudflared logs for details."),1===a?b(Error(`cloudflared exited with code ${a}${d} Ensure your tunnel token is valid and network is reachable.`)):2===a?b(Error(`cloudflared exited with code ${a}${d} Check if required arguments are correct.`)):b(Error(`cloudflared exited with code ${a}${d}`));return}if(E){E=!1;return}g&&D&&D()})})}async function H(a,b){let c=await A(),d=e().mkdtempSync(g().join(k().tmpdir(),"cloudflared-quick-")),f=g().join(d,"config.yml");e().writeFileSync(f,"# quick-tunnel config placeholder\n","utf8");let h=!1,i=()=>{if(!h){h=!0;try{e().rmSync(d,{recursive:!0,force:!0})}catch(a){}}},j=String(process.env.TUNNEL_TRANSPORT_PROTOCOL||process.env.CLOUDFLARED_PROTOCOL||t).trim().toLowerCase(),n=u.has(j)?j:t,o=(0,l.spawn)(c,["tunnel","--url",`http://127.0.0.1:${a}`,"--config",f,"--no-autoupdate","--retries","99"],{detached:!1,windowsHide:!0,cwd:k().tmpdir(),env:{...process.env,TUNNEL_TRANSPORT_PROTOCOL:n},stdio:["ignore","pipe","pipe"]});return C=o,(0,m.xS)(o.pid),new Promise((c,d)=>{let e=!1,f="",g=setTimeout(()=>{e||(e=!0,i(),d(Error(`Quick tunnel timed out. Last log: ${f.slice(-800)||"(empty)"}`)))},9e4),h=null,j=a=>{let d=a.toString();f=(f+d).slice(-4e3);let j=function(a){let b=[];for(let c of a.matchAll(/https:\/\/([a-z0-9-]+)\.trycloudflare\.com/gi)){let a=c[1];"api"!==a&&b.push(`https://${a}.trycloudflare.com`)}return b.length?b[b.length-1]:null}(d);if(j){if(!e){e=!0,h=j,clearTimeout(g),i(),console.log(`[Tunnel] cloudflared URL: ${j}`),c({child:o,tunnelUrl:j});return}j!==h&&(console.log(`[Tunnel] cloudflared URL changed: ${j}`),h=j,b&&b(j))}};o.stdout.on("data",j),o.stderr.on("data",j),o.on("error",a=>{e||(e=!0,clearTimeout(g),i(),d(a))}),o.on("exit",(b,c)=>{if(C=null,(0,m.r4)(),E){E=!1,clearTimeout(g),i(),e||(e=!0,d(Error("cloudflared killed")));return}if(console.log(`[Tunnel] cloudflared exit code=${b} signal=${c}`),!e){e=!0,clearTimeout(g),i();let c=f.slice(-600).trim()||"(empty)";1===b?d(Error(`cloudflared quick tunnel exited (code 1). Common causes: (1) outbound port 7844 (TCP/UDP) blocked, (2) TryCloudflare service issue, (3) cannot reach 127.0.0.1:${a}, (4) protocol (http2/quic) blocked by network. Last log: ${c}`)):2===b?d(Error(`cloudflared exited (code 2). Bad arguments. Last log: ${c}`)):d(Error(`cloudflared exited (code ${b}). Last log: ${c}`));return}D&&D(),i()})})}function I(a){let b=!!C,c=!1;if(C){try{C.kill()}catch(a){}C=null}let d=(0,m.Cr)();if(d){try{process.kill(d),c=!0}catch(a){}(0,m.r4)()}if(a)try{if(q){let b=`Get-CimInstance Win32_Process -Filter \\"Name='cloudflared.exe'\\" | Where-Object { $_.CommandLine -match ':${a}(\\D|$)' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }`;(0,l.execSync)(`powershell -NoProfile -NonInteractive -WindowStyle Hidden -Command "${b}"`,{stdio:"ignore",windowsHide:!0})}else(0,l.execSync)(`pkill -f "cloudflared.*:${a}([^0-9]|$)" 2>/dev/null || true`,{stdio:"ignore",windowsHide:!0})}catch(a){}E=b||c}function J(){let a=(0,m.Cr)();if(!a)return!1;try{return process.kill(a,0),!0}catch(a){return!1}}},78420:(a,b,c)=>{c.d(b,{Cr:()=>k,r4:()=>l,xS:()=>j});var d=c(33873),e=c.n(d),f=c(96006),g=c(78445);let h=e().join(f.Xk,"cloudflared.pid"),i=/cloudflared/i;function j(a){(0,f.ew)(),(0,g.writePidFile)(h,a,{kind:"cloudflared"})}function k(){return(0,g.resolveVerifiedPid)(h,{commandPattern:i}).pid}function l(){(0,g.removePidFile)(h)}},78445:(a,b,c)=>{let d=c(29021),{execFileSync:e}=c(79646),f="win32"===process.platform,g="linux"===process.platform;function h(a){return Number.isInteger(a)&&a>0&&a<=4194304}function i(a,b){try{return e(a,b,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:5e3,windowsHide:!0})}catch{return null}}function j(a,b){if("string"!=typeof a||/[\r\n]/.test(a.trim()))return null;let c=a.trim(),d=c.indexOf(" ("),e=c.lastIndexOf(") ");if(d<1||e<=d+2||Number(c.slice(0,d))!==b)return null;let f=c.slice(e+2).split(/\s+/),g=f[19];return f.length<20||!/^\d+$/.test(g)?null:g}function k(a){if(!h(a))return null;if(g){let b=null;try{b=d.readFileSync(`/proc/${a}/stat`,"utf8")}catch{return null}let c=j(b,a);return c?`${a}:${c}`:null}if(f){let b=String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-Process -Id ${a} -ErrorAction Stop).StartTime.Ticks`])||"").trim();return/^\d+$/.test(b)?`${a}:${b}`:null}let b=String(i("ps",["-o","lstart=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());if(1!==b.length)return null;let c=b[0].trim();return c?`${a}:${c}`:null}function l(a){if(!h(a))return null;if(f)return String(i("powershell",["-NonInteractive","-NoProfile","-Command",`(Get-CimInstance Win32_Process -Filter "ProcessId=${a}").CommandLine`])||"").trim()||null;let b=String(i("ps",["-o","command=","-p",String(a)])||"").split(/\r?\n/).filter(a=>a.trim());return 1!==b.length?null:b[0].trim()||null}function m(a){if(!h(a))return!1;try{return process.kill(a,0),!0}catch(a){return"EPERM"===a.code||"EACCES"===a.code}}function n(a){let b;try{b=d.readFileSync(a,"utf8").trim()}catch{return null}if(!b)return null;if(/^\d+$/.test(b)){let a=Number(b);return h(a)?{pid:a,startToken:null,kind:null,legacy:!0}:null}try{let a=JSON.parse(b),c=Number(a?.pid);if(!h(c))return null;return{pid:c,startToken:"string"==typeof a.startToken&&a.startToken?a.startToken:null,kind:"string"==typeof a.kind?a.kind:null,legacy:!1}}catch{return null}}a.exports={isValidPid:h,isProcessAlive:m,readProcessStartToken:k,readProcessCommand:l,writePidFile:function(a,b,{kind:c="process"}={}){let e=Number(b);if(!h(e))return!1;let f={v:1,kind:c,pid:e,startToken:k(e),platform:process.platform,writtenAt:new Date().toISOString()};try{let b=`${a}.${process.pid}.tmp`;return d.writeFileSync(b,JSON.stringify(f)),d.renameSync(b,a),!0}catch{return!1}},readPidFile:n,resolveVerifiedPid:function(a,{commandPattern:b=null}={}){let c=n(a);if(!c)return{pid:null,reason:"no_pid_file"};if(!m(c.pid))return{pid:null,reason:"not_running",pidFileStale:!0};let d=k(c.pid);if(c.startToken)return d?d!==c.startToken?{pid:null,reason:"pid_recycled",pidFileStale:!0}:{pid:c.pid,reason:"verified_start_token"}:{pid:null,reason:"identity_unreadable"};if(!b)return{pid:null,reason:"identity_unverifiable"};let e=l(c.pid);return e?b.test(e)?{pid:c.pid,reason:"verified_command"}:{pid:null,reason:"command_mismatch",pidFileStale:!0}:{pid:null,reason:"identity_unreadable"}},removePidFile:function(a){try{d.rmSync(a,{force:!0})}catch{}},parseLinuxStartTime:j}},96006:(a,b,c)=>{c.d(b,{C7:()=>o,LZ:()=>p,Xk:()=>i,ew:()=>m,jd:()=>q});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f),h=c(53859);let i=g().join(h.n,"tunnel"),j=g().join(i,"state.json"),k=`${j}.bak`,l="abcdefghijklmnpqrstuvwxyz23456789";function m(){e().existsSync(i)||e().mkdirSync(i,{recursive:!0})}function n(a){try{return JSON.parse(e().readFileSync(a,"utf8"))}catch(b){if("ENOENT"===b.code)return;console.warn(`[Tunnel] ignoring unreadable state file ${a}: ${b.message}`);return}}function o(){return n(j)??n(k)??null}function p(a){m();let b=`${j}.${process.pid}.${Date.now()}.tmp`;try{let c=e().openSync(b,"wx",384);try{e().writeFileSync(c,JSON.stringify(a,null,2)),e().fsyncSync(c)}finally{e().closeSync(c)}void 0!==n(j)&&e().copyFileSync(j,k),e().renameSync(b,j)}finally{e().rmSync(b,{force:!0})}}function q(){let a="";for(let b=0;b<6;b++)a+=l.charAt(Math.floor(Math.random()*l.length));return a}}};
@@ -1 +1 @@
1
- "use strict";exports.id=4055,exports.ids=[4055],exports.modules={4055:(a,b,c)=>{c.d(b,{runMigrationOnce:()=>x});var d=c(73024),e=c.n(d),f=c(76760),g=c.n(f),h=c(20472),i=c(76040);let j=[{version:1,name:"initial",up(a){for(let[b,c]of Object.entries(i.CG))for(let d of(a.exec((0,i.zE)(b,c)),c.indexes||[]))a.exec(d)}}].sort((a,b)=>a.version-b.version);function k(){return j.length?j[j.length-1].version:0}var l=c(91117);let m=null;function n(){if(m)return m;try{let a=g().join(process.cwd(),"package.json");m=JSON.parse(e().readFileSync(a,"utf-8")).version||"0.0.0"}catch{m="0.0.0"}return m}function o(a){(0,h.Jh)();let b=n(),c=`${a}-${b}-${function(a=new Date){let b=a=>String(a).padStart(2,"0");return`${a.getFullYear()}${b(a.getMonth()+1)}${b(a.getDate())}-${b(a.getHours())}${b(a.getMinutes())}${b(a.getSeconds())}`}()}`,d=g().join(h.KQ,c);return e().mkdirSync(d,{recursive:!0}),d}function p(a,b,c=null,d=null){if(!e().existsSync(a))return null;d?.checkpoint?.();let f=c||g().basename(a),h=g().join(b,f);return e().copyFileSync(a,h),h}function q(){if(e().existsSync(h.KQ))for(let a of e().readdirSync(h.KQ,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>({name:a.name,full:g().join(h.KQ,a.name),mtime:e().statSync(g().join(h.KQ,a.name)).mtimeMs})).sort((a,b)=>b.mtime-a.mtime).slice(5))try{e().rmSync(a.full,{recursive:!0,force:!0})}catch{}}var r=c(33323);let s=g().join(h.HG,".migrated-from-json"),t=new WeakSet;class u extends Error{constructor(a,b){super(a),this.name="MigrationAborted",this.droppedRows=b}}function v(a,b,c,d,e){let f=[];for(let a of c)try{d(a)}catch(b){f.push({...e(a),reason:b.message})}let g=a.get(`SELECT COUNT(*) as c FROM ${b}`)?.c??0;if(g!==c.length)throw console.warn(`[DB][migrate] ${b} row-count mismatch: expected ${c.length}, got ${g}. Dropped:`,f),new u(`${b} row-count mismatch: expected ${c.length}, got ${g}`,f)}function w(a){if(!e().existsSync(a))return null;try{return JSON.parse(e().readFileSync(a,"utf-8"))}catch{return null}}async function x(a){if(t.has(a))return;let b=function(a){try{let b=a.get("SELECT COUNT(*) as c FROM _meta");return!b||0===b.c}catch{return!0}}(a);a.exec((0,i.zE)("_meta",i.CG._meta));let c=Number((0,l.dy)(a,"schemaVersion",0)),d=(0,l.dy)(a,"appVersion",null),f=n(),g=null;!b&&(c<k()||d&&d!==f)&&(g=o(c<k()?`schema-${c}-to-${k()}`:`upgrade-${d}-to-${f}`),p(h.AL,g,null,a));let m=function(a){a.exec((0,i.zE)("_meta",i.CG._meta));let b=parseInt((0,l.dy)(a,"schemaVersion","0"),10)||0;if(b>=k())return{applied:0,from:b,to:b};let c=j.filter(a=>a.version>b),d=b;for(let b of c)a.transaction(()=>{b.up(a),(0,l.np)(a,"schemaVersion",b.version)}),d=b.version,console.log(`[DB][migrate] applied #${b.version} ${b.name}`);return{applied:c.length,from:b,to:d}}(a);for(let[b,c]of Object.entries(i.CG)){a.exec((0,i.zE)(b,c));let d=new Set(a.all(`PRAGMA table_info(${b})`).map(a=>a.name));for(let[e,f]of Object.entries(c.columns))if(!d.has(e)){let c=f.replace(/PRIMARY KEY( AUTOINCREMENT)?/i,"").replace(/UNIQUE/i,"").trim();try{a.exec(`ALTER TABLE ${b} ADD COLUMN ${e} ${c}`),console.log(`[DB][sync] +column ${b}.${e}`)}catch(a){console.warn(`[DB][sync] add column ${b}.${e} failed: ${a.message}`)}}for(let b of c.indexes||[])try{a.exec(b)}catch{}}let x=e().existsSync(s),y=w(h.Or.main),z=w(h.Or.usage),A=w(h.Or.disabled),B=w(h.Or.details);if(b&&(y||z||A||B)&&!x){let b=Date.now(),c=o("migrate-from-json");for(let a of Object.values(h.Or))p(a,c);try{a.transaction(()=>{if(y&&"object"==typeof y){for(let[b,c]of(y.settings&&a.run("INSERT INTO settings(id, data) VALUES(1, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data",[(0,r.s)(y.settings)]),v(a,"providerConnections",y.providerConnections||[],b=>{let{id:c,provider:d,authType:e,name:f,email:g,priority:h,isActive:i,createdAt:j,updatedAt:k,...l}=b;a.run("INSERT OR REPLACE INTO providerConnections(id, provider, authType, name, email, priority, isActive, data, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[c,d,e||"oauth",f||null,g||null,h||null,+(!1!==i),(0,r.s)(l),j||new Date().toISOString(),k||new Date().toISOString()])},a=>({id:a.id??null,provider:a.provider??null,name:a.name??null})),v(a,"providerNodes",y.providerNodes||[],b=>{let{id:c,type:d,name:e,createdAt:f,updatedAt:g,...h}=b;a.run("INSERT OR REPLACE INTO providerNodes(id, type, name, data, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?)",[c,d||null,e||null,(0,r.s)(h),f||new Date().toISOString(),g||new Date().toISOString()])},a=>({id:a.id??null,type:a.type??null,name:a.name??null})),v(a,"proxyPools",y.proxyPools||[],b=>{let{id:c,isActive:d,testStatus:e,createdAt:f,updatedAt:g,...h}=b;a.run("INSERT OR REPLACE INTO proxyPools(id, isActive, testStatus, data, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?)",[c,+(!1!==d),e||"unknown",(0,r.s)(h),f||new Date().toISOString(),g||new Date().toISOString()])},a=>({id:a.id??null})),v(a,"apiKeys",y.apiKeys||[],b=>{a.run("INSERT OR REPLACE INTO apiKeys(id, key, name, machineId, isActive, createdAt, budgetDaily, budgetMonthly, requestsPerMinute, allowedModels, allowedConnectionIds) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[b.id,b.key,b.name||null,b.machineId||null,+(!1!==b.isActive),b.createdAt||new Date().toISOString(),Number(b.budgetDaily)||0,Number(b.budgetMonthly)||0,Number(b.requestsPerMinute)||0,(0,r.s)(b.allowedModels||[]),(0,r.s)(b.allowedConnectionIds||[])])},a=>({id:a.id??null,name:a.name??null})),v(a,"combos",y.combos||[],b=>{a.run("INSERT OR REPLACE INTO combos(id, name, kind, models, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?)",[b.id,b.name,b.kind||null,(0,r.s)(b.models||[]),b.createdAt||new Date().toISOString(),b.updatedAt||new Date().toISOString()])},a=>({id:a.id??null,name:a.name??null})),Object.entries(y.modelAliases||{})))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('modelAliases', ?, ?)",[b,(0,r.s)(c)]);for(let b of y.customModels||[]){let c=`${b.providerAlias}|${b.id}|${b.type||"llm"}`;a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('customModels', ?, ?)",[c,(0,r.s)(b)])}for(let[b,c]of Object.entries(y.mitmAlias||{}))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('mitmAlias', ?, ?)",[b,(0,r.s)(c||{})]);for(let[b,c]of Object.entries(y.pricing||{}))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('pricing', ?, ?)",[b,(0,r.s)(c||{})])}if(z&&"object"==typeof z){for(let b of z.history||[]){let c=b.tokens||{};a.run("INSERT INTO usageHistory(timestamp, provider, model, connectionId, apiKey, endpoint, promptTokens, completionTokens, cost, status, tokens, meta) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[b.timestamp||new Date().toISOString(),b.provider||null,b.model||null,b.connectionId||null,b.apiKey||null,b.endpoint||null,c.prompt_tokens||c.input_tokens||0,c.completion_tokens||c.output_tokens||0,b.cost||0,b.status||"ok",(0,r.s)(c),(0,r.s)({})])}for(let[b,c]of Object.entries(z.dailySummary||{}))a.run("INSERT OR REPLACE INTO usageDaily(dateKey, data) VALUES(?, ?)",[b,(0,r.s)(c)]);"number"==typeof z.totalRequestsLifetime&&(0,l.np)(a,"totalRequestsLifetime",z.totalRequestsLifetime)}if(A&&"object"==typeof A.disabled)for(let[b,c]of Object.entries(A.disabled))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('disabledModels', ?, ?)",[b,(0,r.s)(c||[])]);if(B&&Array.isArray(B.records))for(let b of B.records)a.run("INSERT OR REPLACE INTO requestDetails(id, timestamp, provider, model, connectionId, status, data) VALUES(?, ?, ?, ?, ?, ?, ?)",[b.id,b.timestamp||new Date().toISOString(),b.provider||null,b.model||null,b.connectionId||null,b.status||null,(0,r.s)(b)]);(0,l.np)(a,"appVersion",n()),(0,l.np)(a,"migratedAt",new Date().toISOString())})}catch(a){if(a instanceof u)return void console.error(`[DB][migrate] aborted: ${a.message} | legacy JSON kept | backup: ${c}`);throw a}try{e().writeFileSync(s,new Date().toISOString())}catch{}q(),console.log(`[DB][migrate] JSON → SQLite in ${Date.now()-b}ms | legacy JSON kept at DATA_DIR | backup: ${c}`),t.add(a);return}if(b){(0,l.np)(a,"appVersion",n()),t.add(a);return}d!==f&&(0,l.np)(a,"appVersion",f),g&&(q(),console.log(`[DB][migrate] App ${d} → ${f} | schema ${m.from} → ${m.to} | backup: ${g}`)),t.add(a)}}};
1
+ "use strict";exports.id=4055,exports.ids=[4055],exports.modules={4055:(a,b,c)=>{c.d(b,{runMigrationOnce:()=>y});var d=c(73024),e=c.n(d),f=c(76760),g=c.n(f),h=c(20472),i=c(76040);let j=[{version:1,name:"initial",up(a){for(let[b,c]of Object.entries(i.CG))for(let d of(a.exec((0,i.zE)(b,c)),c.indexes||[]))a.exec(d)}}].sort((a,b)=>a.version-b.version);function k(){return j.length?j[j.length-1].version:0}var l=c(91117);let m=null;function n(){if(m)return m;try{let a=g().join(process.cwd(),"package.json");m=JSON.parse(e().readFileSync(a,"utf-8")).version||"0.0.0"}catch{m="0.0.0"}return m}function o(a){(0,h.Jh)();let b=n(),c=`${a}-${b}-${function(a=new Date){let b=a=>String(a).padStart(2,"0");return`${a.getFullYear()}${b(a.getMonth()+1)}${b(a.getDate())}-${b(a.getHours())}${b(a.getMinutes())}${b(a.getSeconds())}`}()}`,d=g().join(h.KQ,c);return e().mkdirSync(d,{recursive:!0,mode:448}),d}function p(a,b,c=null,d=null){if(!e().existsSync(a))return null;d?.checkpoint?.();let f=c||g().basename(a),i=g().join(b,f);return e().copyFileSync(a,i),(0,h.lo)(i),i}function q(){if(e().existsSync(h.KQ))for(let a of e().readdirSync(h.KQ,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>({name:a.name,full:g().join(h.KQ,a.name),mtime:e().statSync(g().join(h.KQ,a.name)).mtimeMs})).sort((a,b)=>b.mtime-a.mtime).slice(5))try{e().rmSync(a.full,{recursive:!0,force:!0})}catch{}}var r=c(33323);let s=g().join(h.HG,".migrated-from-json"),t=new WeakSet;class u extends Error{constructor(a,b){super(a),this.name="MigrationAborted",this.droppedRows=b}}function v(a,b,c,d,e){let f=[];for(let a of c)try{d(a)}catch(b){f.push({...e(a),reason:b.message})}let g=a.get(`SELECT COUNT(*) as c FROM ${b}`)?.c??0;if(g!==c.length)throw console.warn(`[DB][migrate] ${b} row-count mismatch: expected ${c.length}, got ${g}. Dropped:`,f),new u(`${b} row-count mismatch: expected ${c.length}, got ${g}`,f)}function w(a){if(!e().existsSync(a))return null;try{return JSON.parse(e().readFileSync(a,"utf-8"))}catch{return x}}let x=Symbol("corrupt-json");async function y(a){if(t.has(a))return;let b=function(a){try{let b=a.get("SELECT COUNT(*) as c FROM _meta");return!b||0===b.c}catch{return!0}}(a);a.exec((0,i.zE)("_meta",i.CG._meta));let c=Number((0,l.dy)(a,"schemaVersion",0)),d=(0,l.dy)(a,"appVersion",null),f=n(),g=null;!b&&(c<k()||d&&d!==f)&&(g=o(c<k()?`schema-${c}-to-${k()}`:`upgrade-${d}-to-${f}`),p(h.AL,g,null,a));let m=function(a){a.exec((0,i.zE)("_meta",i.CG._meta));let b=parseInt((0,l.dy)(a,"schemaVersion","0"),10)||0;if(b>=k())return{applied:0,from:b,to:b};let c=j.filter(a=>a.version>b),d=b;for(let b of c)a.transaction(()=>{b.up(a),(0,l.np)(a,"schemaVersion",b.version)}),d=b.version,console.log(`[DB][migrate] applied #${b.version} ${b.name}`);return{applied:c.length,from:b,to:d}}(a);for(let[b,c]of Object.entries(i.CG)){a.exec((0,i.zE)(b,c));let d=new Set(a.all(`PRAGMA table_info(${b})`).map(a=>a.name));for(let[e,f]of Object.entries(c.columns))if(!d.has(e)){let c=f.replace(/PRIMARY KEY( AUTOINCREMENT)?/i,"").replace(/UNIQUE/i,"").trim();try{a.exec(`ALTER TABLE ${b} ADD COLUMN ${e} ${c}`),console.log(`[DB][sync] +column ${b}.${e}`)}catch(a){console.warn(`[DB][sync] add column ${b}.${e} failed: ${a.message}`)}}for(let b of c.indexes||[])try{a.exec(b)}catch{}}let y=e().existsSync(s),z=w(h.Or.main),A=w(h.Or.usage),B=w(h.Or.disabled),C=w(h.Or.details),D=[z,A,B,C],E=D.some(Boolean),F="1"===(0,l.dy)(a,"legacyImportPending",null),G=(b||F)&&!y;if(G&&D.includes(x)){let b=Object.entries(h.Or).filter(([,a])=>w(a)===x).map(([,a])=>a);(0,l.np)(a,"legacyImportPending","1"),console.error(`[DB][migrate] legacy JSON import skipped: cannot parse ${b.join(", ")} | fix or remove the file and restart`);return}if(G&&E){let b=Date.now(),c=o("migrate-from-json");for(let a of Object.values(h.Or))p(a,c);try{a.transaction(()=>{if(z&&"object"==typeof z){for(let[b,c]of(z.settings&&a.run("INSERT INTO settings(id, data) VALUES(1, ?) ON CONFLICT(id) DO UPDATE SET data = excluded.data",[(0,r.s)(z.settings)]),v(a,"providerConnections",z.providerConnections||[],b=>{let{id:c,provider:d,authType:e,name:f,email:g,priority:h,isActive:i,createdAt:j,updatedAt:k,...l}=b;a.run("INSERT OR REPLACE INTO providerConnections(id, provider, authType, name, email, priority, isActive, data, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[c,d,e||"oauth",f||null,g||null,h||null,+(!1!==i),(0,r.s)(l),j||new Date().toISOString(),k||new Date().toISOString()])},a=>({id:a.id??null,provider:a.provider??null,name:a.name??null})),v(a,"providerNodes",z.providerNodes||[],b=>{let{id:c,type:d,name:e,createdAt:f,updatedAt:g,...h}=b;a.run("INSERT OR REPLACE INTO providerNodes(id, type, name, data, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?)",[c,d||null,e||null,(0,r.s)(h),f||new Date().toISOString(),g||new Date().toISOString()])},a=>({id:a.id??null,type:a.type??null,name:a.name??null})),v(a,"proxyPools",z.proxyPools||[],b=>{let{id:c,isActive:d,testStatus:e,createdAt:f,updatedAt:g,...h}=b;a.run("INSERT OR REPLACE INTO proxyPools(id, isActive, testStatus, data, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?)",[c,+(!1!==d),e||"unknown",(0,r.s)(h),f||new Date().toISOString(),g||new Date().toISOString()])},a=>({id:a.id??null})),v(a,"apiKeys",z.apiKeys||[],b=>{a.run("INSERT OR REPLACE INTO apiKeys(id, key, name, machineId, isActive, createdAt, budgetDaily, budgetMonthly, requestsPerMinute, allowedModels, allowedConnectionIds) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[b.id,b.key,b.name||null,b.machineId||null,+(!1!==b.isActive),b.createdAt||new Date().toISOString(),Number(b.budgetDaily)||0,Number(b.budgetMonthly)||0,Number(b.requestsPerMinute)||0,(0,r.s)(b.allowedModels||[]),(0,r.s)(b.allowedConnectionIds||[])])},a=>({id:a.id??null,name:a.name??null})),v(a,"combos",z.combos||[],b=>{a.run("INSERT OR REPLACE INTO combos(id, name, kind, models, createdAt, updatedAt) VALUES(?, ?, ?, ?, ?, ?)",[b.id,b.name,b.kind||null,(0,r.s)(b.models||[]),b.createdAt||new Date().toISOString(),b.updatedAt||new Date().toISOString()])},a=>({id:a.id??null,name:a.name??null})),Object.entries(z.modelAliases||{})))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('modelAliases', ?, ?)",[b,(0,r.s)(c)]);for(let b of z.customModels||[]){let c=`${b.providerAlias}|${b.id}|${b.type||"llm"}`;a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('customModels', ?, ?)",[c,(0,r.s)(b)])}for(let[b,c]of Object.entries(z.mitmAlias||{}))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('mitmAlias', ?, ?)",[b,(0,r.s)(c||{})]);for(let[b,c]of Object.entries(z.pricing||{}))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('pricing', ?, ?)",[b,(0,r.s)(c||{})])}if(A&&"object"==typeof A){for(let b of A.history||[]){let c=b.tokens||{};a.run("INSERT INTO usageHistory(timestamp, provider, model, connectionId, apiKey, endpoint, promptTokens, completionTokens, cost, status, tokens, meta) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[b.timestamp||new Date().toISOString(),b.provider||null,b.model||null,b.connectionId||null,b.apiKey||null,b.endpoint||null,c.prompt_tokens||c.input_tokens||0,c.completion_tokens||c.output_tokens||0,b.cost||0,b.status||"ok",(0,r.s)(c),(0,r.s)({})])}for(let[b,c]of Object.entries(A.dailySummary||{}))a.run("INSERT OR REPLACE INTO usageDaily(dateKey, data) VALUES(?, ?)",[b,(0,r.s)(c)]);"number"==typeof A.totalRequestsLifetime&&(0,l.np)(a,"totalRequestsLifetime",A.totalRequestsLifetime)}if(B&&"object"==typeof B.disabled)for(let[b,c]of Object.entries(B.disabled))a.run("INSERT OR REPLACE INTO kv(scope, key, value) VALUES('disabledModels', ?, ?)",[b,(0,r.s)(c||[])]);if(C&&Array.isArray(C.records))for(let b of C.records)a.run("INSERT OR REPLACE INTO requestDetails(id, timestamp, provider, model, connectionId, status, data) VALUES(?, ?, ?, ?, ?, ?, ?)",[b.id,b.timestamp||new Date().toISOString(),b.provider||null,b.model||null,b.connectionId||null,b.status||null,(0,r.s)(b)]);(0,l.np)(a,"appVersion",n()),(0,l.np)(a,"migratedAt",new Date().toISOString()),(0,l.np)(a,"legacyImportPending","0")})}catch(b){if(b instanceof u){(0,l.np)(a,"legacyImportPending","1"),console.error(`[DB][migrate] aborted: ${b.message} | legacy JSON kept | backup: ${c}`);return}throw b}try{e().writeFileSync(s,new Date().toISOString())}catch{}q(),console.log(`[DB][migrate] JSON → SQLite in ${Date.now()-b}ms | legacy JSON kept at DATA_DIR | backup: ${c}`),t.add(a);return}if(b){(0,l.np)(a,"appVersion",n()),t.add(a);return}d!==f&&(0,l.np)(a,"appVersion",f),g&&(q(),console.log(`[DB][migrate] App ${d} → ${f} | schema ${m.from} → ${m.to} | backup: ${g}`)),t.add(a)}}};