ai-agent-router 0.2.2 → 0.2.4

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 (700) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +4 -1
  3. package/.next/build/chunks/{[root-of-the-server]__6d51cb5d._.js → [root-of-the-server]__0iv9ksq._.js} +1 -1
  4. package/.next/build/chunks/[root-of-the-server]__0iv9ksq._.js.map +8 -0
  5. package/.next/build/chunks/{[root-of-the-server]__44695d76._.js → [root-of-the-server]__0rua-~2._.js} +30 -30
  6. package/.next/build/chunks/[root-of-the-server]__0rua-~2._.js.map +11 -0
  7. package/.next/build/chunks/{[turbopack-node]_transforms_postcss_ts_df7a5b11._.js → [turbopack-node]_transforms_postcss_ts_0nnejqq._.js} +2 -2
  8. package/.next/build/chunks/[turbopack]_runtime.js +155 -60
  9. package/.next/build/chunks/[turbopack]_runtime.js.map +6 -5
  10. package/.next/build/chunks/{node_modules_fe693df6._.js → node_modules_13sb.px._.js} +1 -1
  11. package/.next/build/chunks/{node_modules_fe693df6._.js.map → node_modules_13sb.px._.js.map} +42 -42
  12. package/.next/build/postcss.js +5 -5
  13. package/.next/build-manifest.json +8 -7
  14. package/.next/diagnostics/framework.json +1 -1
  15. package/.next/diagnostics/route-bundle-stats.json +93 -0
  16. package/.next/fallback-build-manifest.json +3 -2
  17. package/.next/images-manifest.json +1 -0
  18. package/.next/next-minimal-server.js.nft.json +1 -1
  19. package/.next/next-server.js.nft.json +1 -1
  20. package/.next/prerender-manifest.json +33 -9
  21. package/.next/required-server-files.js +18 -6
  22. package/.next/required-server-files.json +18 -6
  23. package/.next/routes-manifest.json +19 -0
  24. package/.next/server/app/_global-error/page/build-manifest.json +5 -5
  25. package/.next/server/app/_global-error/page.js +8 -9
  26. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  27. package/.next/server/app/_global-error/page_client-reference-manifest.js +2 -1
  28. package/.next/server/app/_global-error.html +1 -2
  29. package/.next/server/app/_global-error.rsc +11 -9
  30. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  31. package/.next/server/app/_global-error.segments/_full.segment.rsc +11 -9
  32. package/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  33. package/.next/server/app/_global-error.segments/_index.segment.rsc +4 -3
  34. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  35. package/.next/server/app/_not-found/page/build-manifest.json +5 -5
  36. package/.next/server/app/_not-found/page.js +11 -12
  37. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  38. package/.next/server/app/_not-found/page_client-reference-manifest.js +2 -1
  39. package/.next/server/app/_not-found.html +1 -1
  40. package/.next/server/app/_not-found.rsc +13 -11
  41. package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -11
  42. package/.next/server/app/_not-found.segments/_head.segment.rsc +3 -3
  43. package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -5
  44. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  45. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +4 -3
  46. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  47. package/.next/server/app/api/config/route/build-manifest.json +1 -3
  48. package/.next/server/app/api/config/route.js +4 -4
  49. package/.next/server/app/api/config/route.js.nft.json +1 -1
  50. package/.next/server/app/api/config/route_client-reference-manifest.js +2 -1
  51. package/.next/server/app/api/gateway/[...path]/route/build-manifest.json +1 -3
  52. package/.next/server/app/api/gateway/[...path]/route.js +5 -5
  53. package/.next/server/app/api/gateway/[...path]/route.js.nft.json +1 -1
  54. package/.next/server/app/api/gateway/[...path]/route_client-reference-manifest.js +2 -1
  55. package/.next/server/app/api/gateway/models/route/build-manifest.json +1 -3
  56. package/.next/server/app/api/gateway/models/route.js +4 -4
  57. package/.next/server/app/api/gateway/models/route.js.nft.json +1 -1
  58. package/.next/server/app/api/gateway/models/route_client-reference-manifest.js +2 -1
  59. package/.next/server/app/api/gateway/route/build-manifest.json +1 -3
  60. package/.next/server/app/api/gateway/route.js +5 -5
  61. package/.next/server/app/api/gateway/route.js.nft.json +1 -1
  62. package/.next/server/app/api/gateway/route_client-reference-manifest.js +2 -1
  63. package/.next/server/app/api/ide/claude/apply/route/build-manifest.json +1 -3
  64. package/.next/server/app/api/ide/claude/apply/route.js +4 -4
  65. package/.next/server/app/api/ide/claude/apply/route.js.nft.json +1 -1
  66. package/.next/server/app/api/ide/claude/apply/route_client-reference-manifest.js +2 -1
  67. package/.next/server/app/api/ide/claude/available-models/route/build-manifest.json +1 -3
  68. package/.next/server/app/api/ide/claude/available-models/route.js +4 -4
  69. package/.next/server/app/api/ide/claude/available-models/route.js.nft.json +1 -1
  70. package/.next/server/app/api/ide/claude/available-models/route_client-reference-manifest.js +2 -1
  71. package/.next/server/app/api/ide/claude/restore/route/build-manifest.json +1 -3
  72. package/.next/server/app/api/ide/claude/restore/route.js +3 -3
  73. package/.next/server/app/api/ide/claude/restore/route.js.nft.json +1 -1
  74. package/.next/server/app/api/ide/claude/restore/route_client-reference-manifest.js +2 -1
  75. package/.next/server/app/api/ide/claude/save/route/build-manifest.json +1 -3
  76. package/.next/server/app/api/ide/claude/save/route.js +4 -4
  77. package/.next/server/app/api/ide/claude/save/route.js.nft.json +1 -1
  78. package/.next/server/app/api/ide/claude/save/route_client-reference-manifest.js +2 -1
  79. package/.next/server/app/api/ide/claude/status/route/build-manifest.json +1 -3
  80. package/.next/server/app/api/ide/claude/status/route.js +4 -4
  81. package/.next/server/app/api/ide/claude/status/route.js.nft.json +1 -1
  82. package/.next/server/app/api/ide/claude/status/route_client-reference-manifest.js +2 -1
  83. package/.next/server/app/api/ide/claude/test/route/build-manifest.json +1 -3
  84. package/.next/server/app/api/ide/claude/test/route.js +5 -5
  85. package/.next/server/app/api/ide/claude/test/route.js.nft.json +1 -1
  86. package/.next/server/app/api/ide/claude/test/route_client-reference-manifest.js +2 -1
  87. package/.next/server/app/api/ide/openclaw/apply/route/build-manifest.json +1 -3
  88. package/.next/server/app/api/ide/openclaw/apply/route.js +4 -4
  89. package/.next/server/app/api/ide/openclaw/apply/route.js.nft.json +1 -1
  90. package/.next/server/app/api/ide/openclaw/apply/route_client-reference-manifest.js +2 -1
  91. package/.next/server/app/api/ide/openclaw/available-models/route/build-manifest.json +1 -3
  92. package/.next/server/app/api/ide/openclaw/available-models/route.js +4 -4
  93. package/.next/server/app/api/ide/openclaw/available-models/route.js.nft.json +1 -1
  94. package/.next/server/app/api/ide/openclaw/available-models/route_client-reference-manifest.js +2 -1
  95. package/.next/server/app/api/ide/openclaw/preview/route/build-manifest.json +1 -3
  96. package/.next/server/app/api/ide/openclaw/preview/route.js +4 -4
  97. package/.next/server/app/api/ide/openclaw/preview/route.js.nft.json +1 -1
  98. package/.next/server/app/api/ide/openclaw/preview/route_client-reference-manifest.js +2 -1
  99. package/.next/server/app/api/ide/openclaw/restore/route/build-manifest.json +1 -3
  100. package/.next/server/app/api/ide/openclaw/restore/route.js +3 -3
  101. package/.next/server/app/api/ide/openclaw/restore/route.js.nft.json +1 -1
  102. package/.next/server/app/api/ide/openclaw/restore/route_client-reference-manifest.js +2 -1
  103. package/.next/server/app/api/ide/openclaw/save/route/build-manifest.json +1 -3
  104. package/.next/server/app/api/ide/openclaw/save/route.js +4 -4
  105. package/.next/server/app/api/ide/openclaw/save/route.js.nft.json +1 -1
  106. package/.next/server/app/api/ide/openclaw/save/route_client-reference-manifest.js +2 -1
  107. package/.next/server/app/api/ide/openclaw/status/route/build-manifest.json +1 -3
  108. package/.next/server/app/api/ide/openclaw/status/route.js +4 -4
  109. package/.next/server/app/api/ide/openclaw/status/route.js.nft.json +1 -1
  110. package/.next/server/app/api/ide/openclaw/status/route_client-reference-manifest.js +2 -1
  111. package/.next/server/app/api/ide/openclaw/test/route/build-manifest.json +1 -3
  112. package/.next/server/app/api/ide/openclaw/test/route.js +3 -3
  113. package/.next/server/app/api/ide/openclaw/test/route.js.nft.json +1 -1
  114. package/.next/server/app/api/ide/openclaw/test/route_client-reference-manifest.js +2 -1
  115. package/.next/server/app/api/ide/opencode/apply/route/build-manifest.json +1 -3
  116. package/.next/server/app/api/ide/opencode/apply/route.js +4 -4
  117. package/.next/server/app/api/ide/opencode/apply/route.js.nft.json +1 -1
  118. package/.next/server/app/api/ide/opencode/apply/route_client-reference-manifest.js +2 -1
  119. package/.next/server/app/api/ide/opencode/available-models/route/build-manifest.json +1 -3
  120. package/.next/server/app/api/ide/opencode/available-models/route.js +4 -4
  121. package/.next/server/app/api/ide/opencode/available-models/route.js.nft.json +1 -1
  122. package/.next/server/app/api/ide/opencode/available-models/route_client-reference-manifest.js +2 -1
  123. package/.next/server/app/api/ide/opencode/preview/route/build-manifest.json +1 -3
  124. package/.next/server/app/api/ide/opencode/preview/route.js +4 -4
  125. package/.next/server/app/api/ide/opencode/preview/route.js.nft.json +1 -1
  126. package/.next/server/app/api/ide/opencode/preview/route_client-reference-manifest.js +2 -1
  127. package/.next/server/app/api/ide/opencode/restore/route/build-manifest.json +1 -3
  128. package/.next/server/app/api/ide/opencode/restore/route.js +3 -3
  129. package/.next/server/app/api/ide/opencode/restore/route.js.nft.json +1 -1
  130. package/.next/server/app/api/ide/opencode/restore/route_client-reference-manifest.js +2 -1
  131. package/.next/server/app/api/ide/opencode/save/route/build-manifest.json +1 -3
  132. package/.next/server/app/api/ide/opencode/save/route.js +4 -4
  133. package/.next/server/app/api/ide/opencode/save/route.js.nft.json +1 -1
  134. package/.next/server/app/api/ide/opencode/save/route_client-reference-manifest.js +2 -1
  135. package/.next/server/app/api/ide/opencode/status/route/build-manifest.json +1 -3
  136. package/.next/server/app/api/ide/opencode/status/route.js +4 -4
  137. package/.next/server/app/api/ide/opencode/status/route.js.nft.json +1 -1
  138. package/.next/server/app/api/ide/opencode/status/route_client-reference-manifest.js +2 -1
  139. package/.next/server/app/api/ide/opencode/test/route/build-manifest.json +1 -3
  140. package/.next/server/app/api/ide/opencode/test/route.js +3 -3
  141. package/.next/server/app/api/ide/opencode/test/route.js.nft.json +1 -1
  142. package/.next/server/app/api/ide/opencode/test/route_client-reference-manifest.js +2 -1
  143. package/.next/server/app/api/logs/route/build-manifest.json +1 -3
  144. package/.next/server/app/api/logs/route.js +4 -4
  145. package/.next/server/app/api/logs/route.js.nft.json +1 -1
  146. package/.next/server/app/api/logs/route_client-reference-manifest.js +2 -1
  147. package/.next/server/app/api/models/route/build-manifest.json +1 -3
  148. package/.next/server/app/api/models/route.js +5 -5
  149. package/.next/server/app/api/models/route.js.nft.json +1 -1
  150. package/.next/server/app/api/models/route_client-reference-manifest.js +2 -1
  151. package/.next/server/app/api/providers/route/build-manifest.json +1 -3
  152. package/.next/server/app/api/providers/route.js +5 -5
  153. package/.next/server/app/api/providers/route.js.nft.json +1 -1
  154. package/.next/server/app/api/providers/route_client-reference-manifest.js +2 -1
  155. package/.next/server/app/api/providers/test/route/build-manifest.json +1 -3
  156. package/.next/server/app/api/providers/test/route.js +5 -5
  157. package/.next/server/app/api/providers/test/route.js.nft.json +1 -1
  158. package/.next/server/app/api/providers/test/route_client-reference-manifest.js +2 -1
  159. package/.next/server/app/api/service/force-stop/route/build-manifest.json +1 -3
  160. package/.next/server/app/api/service/force-stop/route.js +4 -4
  161. package/.next/server/app/api/service/force-stop/route.js.nft.json +1 -1
  162. package/.next/server/app/api/service/force-stop/route_client-reference-manifest.js +2 -1
  163. package/.next/server/app/api/service/start/route/build-manifest.json +1 -3
  164. package/.next/server/app/api/service/start/route.js +4 -4
  165. package/.next/server/app/api/service/start/route.js.nft.json +1 -1
  166. package/.next/server/app/api/service/start/route_client-reference-manifest.js +2 -1
  167. package/.next/server/app/api/service/status/route/build-manifest.json +1 -3
  168. package/.next/server/app/api/service/status/route.js +4 -4
  169. package/.next/server/app/api/service/status/route.js.nft.json +1 -1
  170. package/.next/server/app/api/service/status/route_client-reference-manifest.js +2 -1
  171. package/.next/server/app/api/service/stop/route/build-manifest.json +1 -3
  172. package/.next/server/app/api/service/stop/route.js +4 -4
  173. package/.next/server/app/api/service/stop/route.js.nft.json +1 -1
  174. package/.next/server/app/api/service/stop/route_client-reference-manifest.js +2 -1
  175. package/.next/server/app/api/tokenizer/history/route/app-paths-manifest.json +3 -0
  176. package/.next/server/app/api/tokenizer/history/route/build-manifest.json +9 -0
  177. package/.next/server/app/api/tokenizer/history/route/server-reference-manifest.json +4 -0
  178. package/.next/server/app/api/tokenizer/history/route.js +7 -0
  179. package/.next/server/app/api/tokenizer/history/route.js.map +5 -0
  180. package/.next/server/app/api/tokenizer/history/route.js.nft.json +1 -0
  181. package/.next/server/app/api/tokenizer/history/route_client-reference-manifest.js +3 -0
  182. package/.next/server/app/api/tokenizer/test/route/app-paths-manifest.json +3 -0
  183. package/.next/server/app/api/tokenizer/test/route/build-manifest.json +9 -0
  184. package/.next/server/app/api/tokenizer/test/route/server-reference-manifest.json +4 -0
  185. package/.next/server/app/api/tokenizer/test/route.js +8 -0
  186. package/.next/server/app/api/tokenizer/test/route.js.map +5 -0
  187. package/.next/server/app/api/tokenizer/test/route.js.nft.json +1 -0
  188. package/.next/server/app/api/tokenizer/test/route_client-reference-manifest.js +3 -0
  189. package/.next/server/app/ide/page/build-manifest.json +5 -5
  190. package/.next/server/app/ide/page.js +12 -14
  191. package/.next/server/app/ide/page.js.nft.json +1 -1
  192. package/.next/server/app/ide/page_client-reference-manifest.js +2 -1
  193. package/.next/server/app/ide.html +1 -1
  194. package/.next/server/app/ide.rsc +15 -13
  195. package/.next/server/app/ide.segments/_full.segment.rsc +15 -13
  196. package/.next/server/app/ide.segments/_head.segment.rsc +3 -3
  197. package/.next/server/app/ide.segments/_index.segment.rsc +5 -5
  198. package/.next/server/app/ide.segments/_tree.segment.rsc +2 -2
  199. package/.next/server/app/ide.segments/ide/__PAGE__.segment.rsc +4 -4
  200. package/.next/server/app/ide.segments/ide.segment.rsc +4 -3
  201. package/.next/server/app/index.html +1 -1
  202. package/.next/server/app/index.rsc +11 -11
  203. package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  204. package/.next/server/app/index.segments/_full.segment.rsc +11 -11
  205. package/.next/server/app/index.segments/_head.segment.rsc +3 -3
  206. package/.next/server/app/index.segments/_index.segment.rsc +5 -5
  207. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  208. package/.next/server/app/logs/page/build-manifest.json +5 -5
  209. package/.next/server/app/logs/page.js +12 -14
  210. package/.next/server/app/logs/page.js.nft.json +1 -1
  211. package/.next/server/app/logs/page_client-reference-manifest.js +2 -1
  212. package/.next/server/app/logs.html +1 -1
  213. package/.next/server/app/logs.rsc +15 -13
  214. package/.next/server/app/logs.segments/_full.segment.rsc +15 -13
  215. package/.next/server/app/logs.segments/_head.segment.rsc +3 -3
  216. package/.next/server/app/logs.segments/_index.segment.rsc +5 -5
  217. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  218. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +4 -4
  219. package/.next/server/app/logs.segments/logs.segment.rsc +4 -3
  220. package/.next/server/app/models/page/build-manifest.json +5 -5
  221. package/.next/server/app/models/page.js +12 -14
  222. package/.next/server/app/models/page.js.nft.json +1 -1
  223. package/.next/server/app/models/page_client-reference-manifest.js +2 -1
  224. package/.next/server/app/models.html +1 -1
  225. package/.next/server/app/models.rsc +15 -13
  226. package/.next/server/app/models.segments/_full.segment.rsc +15 -13
  227. package/.next/server/app/models.segments/_head.segment.rsc +3 -3
  228. package/.next/server/app/models.segments/_index.segment.rsc +5 -5
  229. package/.next/server/app/models.segments/_tree.segment.rsc +2 -2
  230. package/.next/server/app/models.segments/models/__PAGE__.segment.rsc +4 -4
  231. package/.next/server/app/models.segments/models.segment.rsc +4 -3
  232. package/.next/server/app/page/build-manifest.json +5 -5
  233. package/.next/server/app/page.js +12 -14
  234. package/.next/server/app/page.js.nft.json +1 -1
  235. package/.next/server/app/page_client-reference-manifest.js +2 -1
  236. package/.next/server/app/providers/page/build-manifest.json +5 -5
  237. package/.next/server/app/providers/page.js +12 -14
  238. package/.next/server/app/providers/page.js.nft.json +1 -1
  239. package/.next/server/app/providers/page_client-reference-manifest.js +2 -1
  240. package/.next/server/app/providers.html +1 -1
  241. package/.next/server/app/providers.rsc +15 -13
  242. package/.next/server/app/providers.segments/_full.segment.rsc +15 -13
  243. package/.next/server/app/providers.segments/_head.segment.rsc +3 -3
  244. package/.next/server/app/providers.segments/_index.segment.rsc +5 -5
  245. package/.next/server/app/providers.segments/_tree.segment.rsc +2 -2
  246. package/.next/server/app/providers.segments/providers/__PAGE__.segment.rsc +4 -4
  247. package/.next/server/app/providers.segments/providers.segment.rsc +4 -3
  248. package/.next/server/app/tokenizer/page/app-paths-manifest.json +3 -0
  249. package/.next/server/app/tokenizer/page/build-manifest.json +16 -0
  250. package/.next/server/app/tokenizer/page/next-font-manifest.json +6 -0
  251. package/.next/server/app/tokenizer/page/react-loadable-manifest.json +1 -0
  252. package/.next/server/app/tokenizer/page/server-reference-manifest.json +4 -0
  253. package/.next/server/app/tokenizer/page.js +13 -0
  254. package/.next/server/app/tokenizer/page.js.map +5 -0
  255. package/.next/server/app/tokenizer/page.js.nft.json +1 -0
  256. package/.next/server/app/tokenizer/page_client-reference-manifest.js +3 -0
  257. package/.next/server/app/tokenizer.html +1 -0
  258. package/.next/server/app/tokenizer.meta +15 -0
  259. package/.next/server/app/tokenizer.rsc +20 -0
  260. package/.next/server/app/tokenizer.segments/_full.segment.rsc +20 -0
  261. package/.next/server/app/tokenizer.segments/_head.segment.rsc +5 -0
  262. package/.next/server/app/tokenizer.segments/_index.segment.rsc +6 -0
  263. package/.next/server/app/tokenizer.segments/_tree.segment.rsc +2 -0
  264. package/.next/server/app/tokenizer.segments/tokenizer/__PAGE__.segment.rsc +9 -0
  265. package/.next/server/app/tokenizer.segments/tokenizer.segment.rsc +5 -0
  266. package/.next/server/app-paths-manifest.json +4 -1
  267. package/.next/server/chunks/0zjb_server_app_api_ide_openclaw_available-models_route_actions_0.gjr6a.js +3 -0
  268. package/.next/server/chunks/0zjb_server_app_api_ide_opencode_available-models_route_actions_0poyhyk.js +3 -0
  269. package/.next/server/chunks/[root-of-the-server]__0-_5z3v._.js +3 -0
  270. package/.next/server/chunks/[root-of-the-server]__0-_5z3v._.js.map +1 -0
  271. package/.next/server/chunks/[root-of-the-server]__012ucp~._.js +3 -0
  272. package/.next/server/chunks/[root-of-the-server]__012ucp~._.js.map +1 -0
  273. package/.next/server/chunks/[root-of-the-server]__01atdgx._.js +3 -0
  274. package/.next/server/chunks/[root-of-the-server]__01atdgx._.js.map +1 -0
  275. package/.next/server/chunks/[root-of-the-server]__01~ft76._.js +3 -0
  276. package/.next/server/chunks/[root-of-the-server]__01~ft76._.js.map +1 -0
  277. package/.next/server/chunks/[root-of-the-server]__04sfkei._.js +3 -0
  278. package/.next/server/chunks/[root-of-the-server]__04sfkei._.js.map +1 -0
  279. package/.next/server/chunks/[root-of-the-server]__065r.wp._.js +3 -0
  280. package/.next/server/chunks/[root-of-the-server]__065r.wp._.js.map +1 -0
  281. package/.next/server/chunks/[root-of-the-server]__07pm7px._.js +3 -0
  282. package/.next/server/chunks/[root-of-the-server]__07pm7px._.js.map +1 -0
  283. package/.next/server/chunks/[root-of-the-server]__07vosna._.js +3 -0
  284. package/.next/server/chunks/[root-of-the-server]__07vosna._.js.map +1 -0
  285. package/.next/server/chunks/[root-of-the-server]__083j1v0._.js +3 -0
  286. package/.next/server/chunks/[root-of-the-server]__083j1v0._.js.map +1 -0
  287. package/.next/server/chunks/[root-of-the-server]__08_ekvs._.js +3 -0
  288. package/.next/server/chunks/[root-of-the-server]__08_ekvs._.js.map +1 -0
  289. package/.next/server/chunks/[root-of-the-server]__08ftz8n._.js +3 -0
  290. package/.next/server/chunks/[root-of-the-server]__08ftz8n._.js.map +1 -0
  291. package/.next/server/chunks/[root-of-the-server]__08oq8ma._.js +3 -0
  292. package/.next/server/chunks/[root-of-the-server]__08oq8ma._.js.map +1 -0
  293. package/.next/server/chunks/[root-of-the-server]__099b1my._.js +3 -0
  294. package/.next/server/chunks/[root-of-the-server]__099b1my._.js.map +1 -0
  295. package/.next/server/chunks/[root-of-the-server]__0aw-~h8._.js +3 -0
  296. package/.next/server/chunks/[root-of-the-server]__0aw-~h8._.js.map +1 -0
  297. package/.next/server/chunks/[root-of-the-server]__0dj43ut._.js +3 -0
  298. package/.next/server/chunks/[root-of-the-server]__0dj43ut._.js.map +1 -0
  299. package/.next/server/chunks/[root-of-the-server]__0efv_yh._.js +3 -0
  300. package/.next/server/chunks/[root-of-the-server]__0efv_yh._.js.map +1 -0
  301. package/.next/server/chunks/[root-of-the-server]__0el37wu._.js +7 -0
  302. package/.next/server/chunks/[root-of-the-server]__0el37wu._.js.map +1 -0
  303. package/.next/server/chunks/[root-of-the-server]__0g.1w-q._.js +3 -0
  304. package/.next/server/chunks/[root-of-the-server]__0g.1w-q._.js.map +1 -0
  305. package/.next/server/chunks/[root-of-the-server]__0im~-m7._.js +3 -0
  306. package/.next/server/chunks/[root-of-the-server]__0im~-m7._.js.map +1 -0
  307. package/.next/server/chunks/[root-of-the-server]__0jf1q27._.js +3 -0
  308. package/.next/server/chunks/[root-of-the-server]__0jf1q27._.js.map +1 -0
  309. package/.next/server/chunks/[root-of-the-server]__0kldv62._.js +3 -0
  310. package/.next/server/chunks/[root-of-the-server]__0kldv62._.js.map +1 -0
  311. package/.next/server/chunks/[root-of-the-server]__0lr16iw._.js +3 -0
  312. package/.next/server/chunks/[root-of-the-server]__0lr16iw._.js.map +1 -0
  313. package/.next/server/chunks/[root-of-the-server]__0m62mql._.js +3 -0
  314. package/.next/server/chunks/[root-of-the-server]__0m62mql._.js.map +1 -0
  315. package/.next/server/chunks/[root-of-the-server]__0qp1t_m._.js +3 -0
  316. package/.next/server/chunks/[root-of-the-server]__0qp1t_m._.js.map +1 -0
  317. package/.next/server/chunks/[root-of-the-server]__0qz-m.u._.js +3 -0
  318. package/.next/server/chunks/[root-of-the-server]__0qz-m.u._.js.map +1 -0
  319. package/.next/server/chunks/[root-of-the-server]__0r235yd._.js +3 -0
  320. package/.next/server/chunks/[root-of-the-server]__0r235yd._.js.map +1 -0
  321. package/.next/server/chunks/[root-of-the-server]__0rjkw2y._.js +3 -0
  322. package/.next/server/chunks/[root-of-the-server]__0rjkw2y._.js.map +1 -0
  323. package/.next/server/chunks/[root-of-the-server]__0uaqs.r._.js +3 -0
  324. package/.next/server/chunks/[root-of-the-server]__0uaqs.r._.js.map +1 -0
  325. package/.next/server/chunks/[root-of-the-server]__0vktxod._.js +3 -0
  326. package/.next/server/chunks/[root-of-the-server]__0vktxod._.js.map +1 -0
  327. package/.next/server/chunks/[root-of-the-server]__0vlh9um._.js +3 -0
  328. package/.next/server/chunks/[root-of-the-server]__0vlh9um._.js.map +1 -0
  329. package/.next/server/chunks/{[root-of-the-server]__c1b4b601._.js → [root-of-the-server]__0xb5i_t._.js} +21 -9
  330. package/.next/server/chunks/[root-of-the-server]__0xb5i_t._.js.map +1 -0
  331. package/.next/server/chunks/[root-of-the-server]__0xsal5d._.js +3 -0
  332. package/.next/server/chunks/[root-of-the-server]__0xsal5d._.js.map +1 -0
  333. package/.next/server/chunks/[root-of-the-server]__0yo.c6n._.js +3 -0
  334. package/.next/server/chunks/[root-of-the-server]__0yo.c6n._.js.map +1 -0
  335. package/.next/server/chunks/[root-of-the-server]__0yz0y4l._.js +13 -0
  336. package/.next/server/chunks/[root-of-the-server]__0yz0y4l._.js.map +1 -0
  337. package/.next/server/chunks/{[root-of-the-server]__e7623a6c._.js → [root-of-the-server]__11srlmi._.js} +2 -2
  338. package/.next/server/chunks/{[root-of-the-server]__e7623a6c._.js.map → [root-of-the-server]__11srlmi._.js.map} +1 -1
  339. package/.next/server/chunks/[root-of-the-server]__12d44rt._.js +3 -0
  340. package/.next/server/chunks/[root-of-the-server]__12d44rt._.js.map +1 -0
  341. package/.next/server/chunks/[turbopack]_runtime.js +168 -60
  342. package/.next/server/chunks/[turbopack]_runtime.js.map +6 -5
  343. package/.next/server/chunks/_0v0oe6c._.js +3 -0
  344. package/.next/server/chunks/{_b48847f5._.js.map → _0v0oe6c._.js.map} +1 -1
  345. package/.next/server/chunks/{_next-internal_server_app_api_config_route_actions_308a9f33.js → _next-internal_server_app_api_config_route_actions_08dm.dx.js} +1 -1
  346. package/.next/server/chunks/{_next-internal_server_app_api_gateway_[___path]_route_actions_835b2379.js → _next-internal_server_app_api_gateway_[___path]_route_actions_0mmqyo7.js} +1 -1
  347. package/.next/server/chunks/{_next-internal_server_app_api_gateway_models_route_actions_302c9983.js → _next-internal_server_app_api_gateway_models_route_actions_08b214z.js} +1 -1
  348. package/.next/server/chunks/{_next-internal_server_app_api_gateway_route_actions_e5e7405d.js → _next-internal_server_app_api_gateway_route_actions_0.jzdw1.js} +1 -1
  349. package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_apply_route_actions_5056516c.js → _next-internal_server_app_api_ide_claude_apply_route_actions_0dw2_pf.js} +1 -1
  350. package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_available-models_route_actions_94d710a0.js → _next-internal_server_app_api_ide_claude_available-models_route_actions_0pmwy75.js} +1 -1
  351. package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_restore_route_actions_f37acc94.js → _next-internal_server_app_api_ide_claude_restore_route_actions_11x77hl.js} +1 -1
  352. package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_save_route_actions_407c55f5.js → _next-internal_server_app_api_ide_claude_save_route_actions_0b35ro_.js} +1 -1
  353. package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_status_route_actions_5ac73db8.js → _next-internal_server_app_api_ide_claude_status_route_actions_0fnw-w7.js} +1 -1
  354. package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_test_route_actions_70587902.js → _next-internal_server_app_api_ide_claude_test_route_actions_0jc1czy.js} +1 -1
  355. package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_apply_route_actions_2cb9e4b4.js → _next-internal_server_app_api_ide_openclaw_apply_route_actions_07re971.js} +1 -1
  356. package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_preview_route_actions_9814a8e4.js → _next-internal_server_app_api_ide_openclaw_preview_route_actions_0q53p05.js} +1 -1
  357. package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_restore_route_actions_10ad8f9d.js → _next-internal_server_app_api_ide_openclaw_restore_route_actions_02yog9-.js} +1 -1
  358. package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_save_route_actions_044ad081.js → _next-internal_server_app_api_ide_openclaw_save_route_actions_00tjxsz.js} +1 -1
  359. package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_status_route_actions_ed9786d2.js → _next-internal_server_app_api_ide_openclaw_status_route_actions_10wsun4.js} +1 -1
  360. package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_test_route_actions_ce2cb808.js → _next-internal_server_app_api_ide_openclaw_test_route_actions_0zgwyon.js} +1 -1
  361. package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_apply_route_actions_6c422244.js → _next-internal_server_app_api_ide_opencode_apply_route_actions_0in-w.g.js} +1 -1
  362. package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_preview_route_actions_256c82e0.js → _next-internal_server_app_api_ide_opencode_preview_route_actions_06h6.w~.js} +1 -1
  363. package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_restore_route_actions_371993d3.js → _next-internal_server_app_api_ide_opencode_restore_route_actions_09ipt-l.js} +1 -1
  364. package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_save_route_actions_6e4c9c41.js → _next-internal_server_app_api_ide_opencode_save_route_actions_0i-~x79.js} +1 -1
  365. package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_status_route_actions_498ad77b.js → _next-internal_server_app_api_ide_opencode_status_route_actions_0cpf6rv.js} +1 -1
  366. package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_test_route_actions_c71be510.js → _next-internal_server_app_api_ide_opencode_test_route_actions_0y8aq8h.js} +1 -1
  367. package/.next/server/chunks/{_next-internal_server_app_api_logs_route_actions_30a87f47.js → _next-internal_server_app_api_logs_route_actions_08ef2j7.js} +1 -1
  368. package/.next/server/chunks/{_next-internal_server_app_api_models_route_actions_b6abdc83.js → _next-internal_server_app_api_models_route_actions_0vfccm4.js} +1 -1
  369. package/.next/server/chunks/{_next-internal_server_app_api_providers_route_actions_5388b373.js → _next-internal_server_app_api_providers_route_actions_0ee1p_m.js} +1 -1
  370. package/.next/server/chunks/{_next-internal_server_app_api_providers_test_route_actions_b97ab15a.js → _next-internal_server_app_api_providers_test_route_actions_0vyo652.js} +1 -1
  371. package/.next/server/chunks/{_next-internal_server_app_api_service_force-stop_route_actions_95eba80b.js → _next-internal_server_app_api_service_force-stop_route_actions_0pu9xrq.js} +1 -1
  372. package/.next/server/chunks/{_next-internal_server_app_api_service_start_route_actions_d50efb77.js → _next-internal_server_app_api_service_start_route_actions_0_o53a2.js} +1 -1
  373. package/.next/server/chunks/{_next-internal_server_app_api_service_status_route_actions_30149042.js → _next-internal_server_app_api_service_status_route_actions_08ag8v4.js} +1 -1
  374. package/.next/server/chunks/{_next-internal_server_app_api_service_stop_route_actions_19443941.js → _next-internal_server_app_api_service_stop_route_actions_04dp83p.js} +1 -1
  375. package/.next/server/chunks/_next-internal_server_app_api_tokenizer_history_route_actions_09~nqtd.js +3 -0
  376. package/.next/server/chunks/_next-internal_server_app_api_tokenizer_test_route_actions_0t2swp-.js +3 -0
  377. package/.next/server/chunks/{node_modules_next_dist_esm_build_templates_app-route_4be65264.js → node_modules_next_dist_esm_build_templates_app-route_0d1n5~u.js} +6 -6
  378. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0d1n5~u.js.map +1 -0
  379. package/.next/server/chunks/ssr/[root-of-the-server]__0.zquoa._.js +3 -0
  380. package/.next/server/chunks/ssr/[root-of-the-server]__0.zquoa._.js.map +1 -0
  381. package/.next/server/chunks/ssr/[root-of-the-server]__01dqyhh._.js +3 -0
  382. package/.next/server/chunks/ssr/[root-of-the-server]__01dqyhh._.js.map +1 -0
  383. package/.next/server/chunks/ssr/[root-of-the-server]__04qwc64._.js +3 -0
  384. package/.next/server/chunks/ssr/[root-of-the-server]__04qwc64._.js.map +1 -0
  385. package/.next/server/chunks/ssr/[root-of-the-server]__06r_ug4._.js +3 -0
  386. package/.next/server/chunks/ssr/[root-of-the-server]__06r_ug4._.js.map +1 -0
  387. package/.next/server/chunks/ssr/{[root-of-the-server]__f92001a5._.js → [root-of-the-server]__0814l01._.js} +2 -2
  388. package/.next/server/chunks/ssr/[root-of-the-server]__0814l01._.js.map +1 -0
  389. package/.next/server/chunks/ssr/[root-of-the-server]__0gb1hlj._.js +3 -0
  390. package/.next/server/chunks/ssr/[root-of-the-server]__0gb1hlj._.js.map +1 -0
  391. package/.next/server/chunks/ssr/[root-of-the-server]__0p8tmu2._.js +3 -0
  392. package/.next/server/chunks/ssr/[root-of-the-server]__0p8tmu2._.js.map +1 -0
  393. package/.next/server/chunks/ssr/[root-of-the-server]__0rf3.7n._.js +3 -0
  394. package/.next/server/chunks/ssr/[root-of-the-server]__0rf3.7n._.js.map +1 -0
  395. package/.next/server/chunks/ssr/[root-of-the-server]__0~6rwng._.js +33 -0
  396. package/.next/server/chunks/ssr/[root-of-the-server]__0~6rwng._.js.map +1 -0
  397. package/.next/server/chunks/ssr/[root-of-the-server]__10xgshr._.js +33 -0
  398. package/.next/server/chunks/ssr/[root-of-the-server]__10xgshr._.js.map +1 -0
  399. package/.next/server/chunks/ssr/[root-of-the-server]__11i~7lq._.js +3 -0
  400. package/.next/server/chunks/ssr/[root-of-the-server]__11i~7lq._.js.map +1 -0
  401. package/.next/server/chunks/ssr/[turbopack]_runtime.js +168 -60
  402. package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +6 -5
  403. package/.next/server/chunks/ssr/_0k83omg._.js +6 -0
  404. package/.next/server/chunks/ssr/_0k83omg._.js.map +1 -0
  405. package/.next/server/chunks/ssr/_0yyi5po._.js +3 -0
  406. package/.next/server/chunks/ssr/_0yyi5po._.js.map +1 -0
  407. package/.next/server/chunks/ssr/{_next-internal_server_app__global-error_page_actions_75761787.js → _next-internal_server_app__global-error_page_actions_0k77kol.js} +1 -1
  408. package/.next/server/chunks/ssr/{_next-internal_server_app__not-found_page_actions_554ec2bf.js → _next-internal_server_app__not-found_page_actions_0eq97pa.js} +1 -1
  409. package/.next/server/chunks/ssr/{_next-internal_server_app_ide_page_actions_d521d6ae.js → _next-internal_server_app_ide_page_actions_0_opd4~.js} +1 -1
  410. package/.next/server/chunks/ssr/{_next-internal_server_app_logs_page_actions_a1c69041.js → _next-internal_server_app_logs_page_actions_0rvsl~d.js} +1 -1
  411. package/.next/server/chunks/ssr/{_next-internal_server_app_models_page_actions_543cf22f.js → _next-internal_server_app_models_page_actions_0eiz7f7.js} +1 -1
  412. package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js +3 -0
  413. package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_09-gtaw.js.map +1 -0
  414. package/.next/server/chunks/ssr/{_next-internal_server_app_providers_page_actions_c75f6cb3.js → _next-internal_server_app_providers_page_actions_0ya36nw.js} +1 -1
  415. package/.next/server/chunks/ssr/_next-internal_server_app_providers_page_actions_0ya36nw.js.map +1 -0
  416. package/.next/server/chunks/ssr/_next-internal_server_app_tokenizer_page_actions_0imc_ya.js +3 -0
  417. package/.next/server/chunks/ssr/_next-internal_server_app_tokenizer_page_actions_0imc_ya.js.map +1 -0
  418. package/.next/server/chunks/ssr/node_modules_09w7yel._.js +33 -0
  419. package/.next/server/chunks/ssr/node_modules_09w7yel._.js.map +1 -0
  420. package/.next/server/chunks/ssr/node_modules_next_dist_06hehg4._.js +19 -0
  421. package/.next/server/chunks/ssr/node_modules_next_dist_06hehg4._.js.map +1 -0
  422. package/.next/server/chunks/ssr/node_modules_next_dist_0e1izl_._.js +6 -0
  423. package/.next/server/chunks/ssr/node_modules_next_dist_0e1izl_._.js.map +1 -0
  424. package/.next/server/chunks/ssr/{node_modules_next_dist_client_components_9774470f._.js → node_modules_next_dist_client_components_0inhx6q._.js} +2 -2
  425. package/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_forbidden_45780354.js → node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js} +2 -2
  426. package/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_global-error_ece394eb.js → node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js} +2 -2
  427. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js.map +1 -0
  428. package/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_unauthorized_15817684.js → node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js} +2 -2
  429. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_05u.ff5.js +4 -0
  430. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_05u.ff5.js.map +1 -0
  431. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_06a5k-w.js +4 -0
  432. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_06a5k-w.js.map +1 -0
  433. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0_rrdx6.js +4 -0
  434. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0_rrdx6.js.map +1 -0
  435. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0a7b~p7.js +4 -0
  436. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0a7b~p7.js.map +1 -0
  437. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0bj8dkg.js +4 -0
  438. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0bj8dkg.js.map +1 -0
  439. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0cvrgh7.js +4 -0
  440. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0cvrgh7.js.map +1 -0
  441. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0nkcfme.js +4 -0
  442. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0nkcfme.js.map +1 -0
  443. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0rc3ul_.js +4 -0
  444. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0rc3ul_.js.map +1 -0
  445. package/.next/server/chunks/ssr/src_app_components_ConfirmDialog_tsx_0mm3plr._.js +3 -0
  446. package/.next/server/chunks/ssr/src_app_components_ConfirmDialog_tsx_0mm3plr._.js.map +1 -0
  447. package/.next/server/chunks/ssr/src_app_ide_page_tsx_0no40dj._.js +3 -0
  448. package/.next/server/chunks/ssr/{src_app_ide_page_tsx_8962793b._.js.map → src_app_ide_page_tsx_0no40dj._.js.map} +1 -1
  449. package/.next/server/chunks/ssr/src_app_logs_page_tsx_0l8mmxe._.js +3 -0
  450. package/.next/server/chunks/ssr/{src_app_logs_page_tsx_7b7b7b83._.js.map → src_app_logs_page_tsx_0l8mmxe._.js.map} +1 -1
  451. package/.next/server/chunks/ssr/src_app_models_page_tsx_10vsbc1._.js +3 -0
  452. package/.next/server/chunks/ssr/{src_app_models_page_tsx_ed71d32e._.js.map → src_app_models_page_tsx_10vsbc1._.js.map} +1 -1
  453. package/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js +3 -0
  454. package/.next/server/chunks/ssr/src_app_page_tsx_0ss2.w7._.js.map +1 -0
  455. package/.next/server/chunks/ssr/src_app_providers_page_tsx_10ipz~8._.js +3 -0
  456. package/.next/server/chunks/ssr/{src_app_providers_page_tsx_eb8b5137._.js.map → src_app_providers_page_tsx_10ipz~8._.js.map} +1 -1
  457. package/.next/server/chunks/ssr/src_app_tokenizer_page_tsx_0eqhpbs._.js +3 -0
  458. package/.next/server/chunks/ssr/src_app_tokenizer_page_tsx_0eqhpbs._.js.map +1 -0
  459. package/.next/server/functions-config-manifest.json +3 -1
  460. package/.next/server/middleware-build-manifest.js +10 -10
  461. package/.next/server/pages/404.html +1 -1
  462. package/.next/server/pages/500.html +1 -2
  463. package/.next/server/prefetch-hints.json +1 -0
  464. package/.next/server/server-reference-manifest.js +1 -1
  465. package/.next/server/server-reference-manifest.json +1 -1
  466. package/.next/static/XHnu7Z1vWSrgmneps8rX4/_clientMiddlewareManifest.js +1 -0
  467. package/.next/static/chunks/01xlw8hd842-c.js +1 -0
  468. package/.next/static/chunks/0bzupvr5gt3k9.js +31 -0
  469. package/.next/static/chunks/0d3shmwh5_nmn.js +1 -0
  470. package/.next/static/chunks/0h7-_zr5_nt.5.js +1 -0
  471. package/.next/static/chunks/0mjx90nkvhsot.js +1 -0
  472. package/.next/static/chunks/0ntp1qkrtsgn0.js +1 -0
  473. package/.next/static/chunks/0tc5l6c1zalyc.css +1 -0
  474. package/.next/static/chunks/0v7.1nc4jyaet.js +1 -0
  475. package/.next/static/chunks/0vlwn301rv7dw.js +1 -0
  476. package/.next/static/chunks/0y3~cortx~or~.js +5 -0
  477. package/.next/static/chunks/0~c9fm3-3-f41.js +1 -0
  478. package/.next/static/chunks/11-7_fybhp2~y.js +1 -0
  479. package/.next/static/chunks/121-ofr4.6_5t.js +1 -0
  480. package/.next/static/chunks/16g.ca89g7fib.js +1 -0
  481. package/.next/static/chunks/turbopack-0griofc2i3wvs.js +1 -0
  482. package/.next/types/routes.d.ts +5 -2
  483. package/.next/types/validator.ts +27 -0
  484. package/CHANGELOG.md +15 -0
  485. package/README.md +6 -0
  486. package/dist/.next/dev/types/validator.js +12 -0
  487. package/dist/.next/types/validator.js +12 -0
  488. package/dist/package.json +3 -2
  489. package/dist/src/app/api/tokenizer/history/route.js +60 -0
  490. package/dist/src/app/api/tokenizer/test/route.js +97 -0
  491. package/dist/src/app/components/Nav.js +2 -1
  492. package/dist/src/app/tokenizer/page.js +318 -0
  493. package/dist/src/cli/index.js +3 -3
  494. package/dist/src/db/database.js +19 -21
  495. package/dist/src/db/queries.js +21 -0
  496. package/dist/src/server/tokenizer.js +215 -0
  497. package/package.json +3 -2
  498. package/src/app/api/tokenizer/history/route.ts +63 -0
  499. package/src/app/api/tokenizer/test/route.ts +151 -0
  500. package/src/app/components/Nav.tsx +2 -2
  501. package/src/app/tokenizer/page.tsx +813 -0
  502. package/src/cli/index.ts +4 -4
  503. package/src/db/database.ts +18 -25
  504. package/src/db/queries.ts +22 -0
  505. package/src/server/tokenizer.ts +285 -0
  506. package/.next/build/chunks/[root-of-the-server]__44695d76._.js.map +0 -11
  507. package/.next/build/chunks/[root-of-the-server]__6d51cb5d._.js.map +0 -8
  508. package/.next/server/chunks/[root-of-the-server]__001d5756._.js +0 -3
  509. package/.next/server/chunks/[root-of-the-server]__001d5756._.js.map +0 -1
  510. package/.next/server/chunks/[root-of-the-server]__05f8578b._.js +0 -3
  511. package/.next/server/chunks/[root-of-the-server]__05f8578b._.js.map +0 -1
  512. package/.next/server/chunks/[root-of-the-server]__1480f018._.js +0 -3
  513. package/.next/server/chunks/[root-of-the-server]__1480f018._.js.map +0 -1
  514. package/.next/server/chunks/[root-of-the-server]__1909f3aa._.js +0 -3
  515. package/.next/server/chunks/[root-of-the-server]__1909f3aa._.js.map +0 -1
  516. package/.next/server/chunks/[root-of-the-server]__1d4b7fc5._.js +0 -3
  517. package/.next/server/chunks/[root-of-the-server]__1d4b7fc5._.js.map +0 -1
  518. package/.next/server/chunks/[root-of-the-server]__33fec899._.js +0 -3
  519. package/.next/server/chunks/[root-of-the-server]__33fec899._.js.map +0 -1
  520. package/.next/server/chunks/[root-of-the-server]__372ef2bf._.js +0 -3
  521. package/.next/server/chunks/[root-of-the-server]__372ef2bf._.js.map +0 -1
  522. package/.next/server/chunks/[root-of-the-server]__3a204d25._.js +0 -3
  523. package/.next/server/chunks/[root-of-the-server]__3a204d25._.js.map +0 -1
  524. package/.next/server/chunks/[root-of-the-server]__3aaf963c._.js +0 -3
  525. package/.next/server/chunks/[root-of-the-server]__3aaf963c._.js.map +0 -1
  526. package/.next/server/chunks/[root-of-the-server]__43810962._.js +0 -3
  527. package/.next/server/chunks/[root-of-the-server]__43810962._.js.map +0 -1
  528. package/.next/server/chunks/[root-of-the-server]__4a8f9bc7._.js +0 -3
  529. package/.next/server/chunks/[root-of-the-server]__4a8f9bc7._.js.map +0 -1
  530. package/.next/server/chunks/[root-of-the-server]__55cd88b8._.js +0 -3
  531. package/.next/server/chunks/[root-of-the-server]__55cd88b8._.js.map +0 -1
  532. package/.next/server/chunks/[root-of-the-server]__59aacd30._.js +0 -21
  533. package/.next/server/chunks/[root-of-the-server]__59aacd30._.js.map +0 -1
  534. package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js +0 -3
  535. package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js.map +0 -1
  536. package/.next/server/chunks/[root-of-the-server]__64356cb2._.js +0 -3
  537. package/.next/server/chunks/[root-of-the-server]__64356cb2._.js.map +0 -1
  538. package/.next/server/chunks/[root-of-the-server]__6ce199d2._.js +0 -3
  539. package/.next/server/chunks/[root-of-the-server]__6ce199d2._.js.map +0 -1
  540. package/.next/server/chunks/[root-of-the-server]__760eaa16._.js +0 -3
  541. package/.next/server/chunks/[root-of-the-server]__760eaa16._.js.map +0 -1
  542. package/.next/server/chunks/[root-of-the-server]__772134c6._.js +0 -3
  543. package/.next/server/chunks/[root-of-the-server]__772134c6._.js.map +0 -1
  544. package/.next/server/chunks/[root-of-the-server]__7b77f523._.js +0 -3
  545. package/.next/server/chunks/[root-of-the-server]__7b77f523._.js.map +0 -1
  546. package/.next/server/chunks/[root-of-the-server]__7c298a19._.js +0 -3
  547. package/.next/server/chunks/[root-of-the-server]__7c298a19._.js.map +0 -1
  548. package/.next/server/chunks/[root-of-the-server]__85540228._.js +0 -3
  549. package/.next/server/chunks/[root-of-the-server]__85540228._.js.map +0 -1
  550. package/.next/server/chunks/[root-of-the-server]__94fe8d3c._.js +0 -3
  551. package/.next/server/chunks/[root-of-the-server]__94fe8d3c._.js.map +0 -1
  552. package/.next/server/chunks/[root-of-the-server]__97622908._.js +0 -3
  553. package/.next/server/chunks/[root-of-the-server]__97622908._.js.map +0 -1
  554. package/.next/server/chunks/[root-of-the-server]__a02e6618._.js +0 -3
  555. package/.next/server/chunks/[root-of-the-server]__a02e6618._.js.map +0 -1
  556. package/.next/server/chunks/[root-of-the-server]__a32a20a7._.js +0 -3
  557. package/.next/server/chunks/[root-of-the-server]__a32a20a7._.js.map +0 -1
  558. package/.next/server/chunks/[root-of-the-server]__a719d045._.js +0 -3
  559. package/.next/server/chunks/[root-of-the-server]__a719d045._.js.map +0 -1
  560. package/.next/server/chunks/[root-of-the-server]__af5b556a._.js +0 -3
  561. package/.next/server/chunks/[root-of-the-server]__af5b556a._.js.map +0 -1
  562. package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js.map +0 -1
  563. package/.next/server/chunks/[root-of-the-server]__cafe113e._.js +0 -3
  564. package/.next/server/chunks/[root-of-the-server]__cafe113e._.js.map +0 -1
  565. package/.next/server/chunks/[root-of-the-server]__ccfc7f1d._.js +0 -3
  566. package/.next/server/chunks/[root-of-the-server]__ccfc7f1d._.js.map +0 -1
  567. package/.next/server/chunks/[root-of-the-server]__dc8b0bed._.js +0 -3
  568. package/.next/server/chunks/[root-of-the-server]__dc8b0bed._.js.map +0 -1
  569. package/.next/server/chunks/[root-of-the-server]__f0461b8d._.js +0 -3
  570. package/.next/server/chunks/[root-of-the-server]__f0461b8d._.js.map +0 -1
  571. package/.next/server/chunks/[root-of-the-server]__f8949f88._.js +0 -3
  572. package/.next/server/chunks/[root-of-the-server]__f8949f88._.js.map +0 -1
  573. package/.next/server/chunks/_b48847f5._.js +0 -3
  574. package/.next/server/chunks/ce889_server_app_api_ide_openclaw_available-models_route_actions_e568e70b.js +0 -3
  575. package/.next/server/chunks/ce889_server_app_api_ide_opencode_available-models_route_actions_95230db3.js +0 -3
  576. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_4be65264.js.map +0 -1
  577. package/.next/server/chunks/ssr/[root-of-the-server]__083d944d._.js +0 -3
  578. package/.next/server/chunks/ssr/[root-of-the-server]__083d944d._.js.map +0 -1
  579. package/.next/server/chunks/ssr/[root-of-the-server]__15600e29._.js +0 -3
  580. package/.next/server/chunks/ssr/[root-of-the-server]__15600e29._.js.map +0 -1
  581. package/.next/server/chunks/ssr/[root-of-the-server]__1836f866._.js +0 -3
  582. package/.next/server/chunks/ssr/[root-of-the-server]__1836f866._.js.map +0 -1
  583. package/.next/server/chunks/ssr/[root-of-the-server]__256a03fe._.js +0 -3
  584. package/.next/server/chunks/ssr/[root-of-the-server]__256a03fe._.js.map +0 -1
  585. package/.next/server/chunks/ssr/[root-of-the-server]__31fde618._.js +0 -3
  586. package/.next/server/chunks/ssr/[root-of-the-server]__31fde618._.js.map +0 -1
  587. package/.next/server/chunks/ssr/[root-of-the-server]__523c120c._.js +0 -3
  588. package/.next/server/chunks/ssr/[root-of-the-server]__523c120c._.js.map +0 -1
  589. package/.next/server/chunks/ssr/[root-of-the-server]__70a81394._.js +0 -3
  590. package/.next/server/chunks/ssr/[root-of-the-server]__70a81394._.js.map +0 -1
  591. package/.next/server/chunks/ssr/[root-of-the-server]__81937253._.js +0 -3
  592. package/.next/server/chunks/ssr/[root-of-the-server]__81937253._.js.map +0 -1
  593. package/.next/server/chunks/ssr/[root-of-the-server]__976ad963._.js +0 -3
  594. package/.next/server/chunks/ssr/[root-of-the-server]__976ad963._.js.map +0 -1
  595. package/.next/server/chunks/ssr/[root-of-the-server]__af2ad6aa._.js +0 -3
  596. package/.next/server/chunks/ssr/[root-of-the-server]__af2ad6aa._.js.map +0 -1
  597. package/.next/server/chunks/ssr/[root-of-the-server]__b9356576._.js +0 -4
  598. package/.next/server/chunks/ssr/[root-of-the-server]__b9356576._.js.map +0 -1
  599. package/.next/server/chunks/ssr/[root-of-the-server]__ccb6a4da._.js +0 -3
  600. package/.next/server/chunks/ssr/[root-of-the-server]__ccb6a4da._.js.map +0 -1
  601. package/.next/server/chunks/ssr/[root-of-the-server]__cfa2d991._.js +0 -3
  602. package/.next/server/chunks/ssr/[root-of-the-server]__cfa2d991._.js.map +0 -1
  603. package/.next/server/chunks/ssr/[root-of-the-server]__f437da88._.js +0 -3
  604. package/.next/server/chunks/ssr/[root-of-the-server]__f437da88._.js.map +0 -1
  605. package/.next/server/chunks/ssr/[root-of-the-server]__f92001a5._.js.map +0 -1
  606. package/.next/server/chunks/ssr/_06262cbd._.js +0 -4
  607. package/.next/server/chunks/ssr/_06262cbd._.js.map +0 -1
  608. package/.next/server/chunks/ssr/_0cd72da5._.js +0 -4
  609. package/.next/server/chunks/ssr/_0cd72da5._.js.map +0 -1
  610. package/.next/server/chunks/ssr/_4828a6d2._.js +0 -4
  611. package/.next/server/chunks/ssr/_4828a6d2._.js.map +0 -1
  612. package/.next/server/chunks/ssr/_69468f4c._.js +0 -3
  613. package/.next/server/chunks/ssr/_69468f4c._.js.map +0 -1
  614. package/.next/server/chunks/ssr/_93850476._.js +0 -6
  615. package/.next/server/chunks/ssr/_93850476._.js.map +0 -1
  616. package/.next/server/chunks/ssr/_c1309523._.js +0 -4
  617. package/.next/server/chunks/ssr/_c1309523._.js.map +0 -1
  618. package/.next/server/chunks/ssr/_f7d273e3._.js +0 -4
  619. package/.next/server/chunks/ssr/_f7d273e3._.js.map +0 -1
  620. package/.next/server/chunks/ssr/_next-internal_server_app_page_actions_39d4fc33.js +0 -3
  621. package/.next/server/chunks/ssr/node_modules_next_dist_08570d7f._.js +0 -4
  622. package/.next/server/chunks/ssr/node_modules_next_dist_08570d7f._.js.map +0 -1
  623. package/.next/server/chunks/ssr/node_modules_next_dist_174ae28d._.js +0 -10
  624. package/.next/server/chunks/ssr/node_modules_next_dist_174ae28d._.js.map +0 -1
  625. package/.next/server/chunks/ssr/node_modules_next_dist_27457240._.js +0 -6
  626. package/.next/server/chunks/ssr/node_modules_next_dist_27457240._.js.map +0 -1
  627. package/.next/server/chunks/ssr/node_modules_next_dist_4b63a0e1._.js +0 -3
  628. package/.next/server/chunks/ssr/node_modules_next_dist_4b63a0e1._.js.map +0 -1
  629. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_ece394eb.js.map +0 -1
  630. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_65a7265e.js +0 -4
  631. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_65a7265e.js.map +0 -1
  632. package/.next/server/chunks/ssr/node_modules_next_dist_f9713a08._.js +0 -3
  633. package/.next/server/chunks/ssr/node_modules_next_dist_f9713a08._.js.map +0 -1
  634. package/.next/server/chunks/ssr/src_app_ide_page_tsx_8962793b._.js +0 -3
  635. package/.next/server/chunks/ssr/src_app_logs_page_tsx_7b7b7b83._.js +0 -3
  636. package/.next/server/chunks/ssr/src_app_models_page_tsx_ed71d32e._.js +0 -3
  637. package/.next/server/chunks/ssr/src_app_providers_page_tsx_eb8b5137._.js +0 -3
  638. package/.next/static/cf2SWIkI5HVbnDjLExI42/_clientMiddlewareManifest.json +0 -1
  639. package/.next/static/chunks/5663c8696095f277.js +0 -1
  640. package/.next/static/chunks/64f547b3bcd3aef4.js +0 -1
  641. package/.next/static/chunks/6992685fe009e8fd.css +0 -1
  642. package/.next/static/chunks/6e0dee5b6681763c.js +0 -1
  643. package/.next/static/chunks/6f7efe5271343778.js +0 -1
  644. package/.next/static/chunks/75f76753fd97c8fd.js +0 -1
  645. package/.next/static/chunks/7c8b7cbb3339f139.js +0 -1
  646. package/.next/static/chunks/8ccc14e022ff6de3.js +0 -1
  647. package/.next/static/chunks/8cf1e5f00ebaea52.js +0 -1
  648. package/.next/static/chunks/a6dad97d9634a72d.js.map +0 -1
  649. package/.next/static/chunks/a7f539bf6487f4ff.js +0 -5
  650. package/.next/static/chunks/a89fdf03c5b0dfbd.js +0 -1
  651. package/.next/static/chunks/d2be314c3ece3fbe.js +0 -1
  652. package/.next/static/chunks/f2f58a7e93290fbb.js +0 -1
  653. package/.next/static/chunks/ff1a16fafef87110.js +0 -1
  654. package/.next/static/chunks/turbopack-fdb839c72e10c2ea.js +0 -4
  655. /package/.next/build/chunks/{[turbopack-node]_transforms_postcss_ts_df7a5b11._.js.map → [turbopack-node]_transforms_postcss_ts_0nnejqq._.js.map} +0 -0
  656. /package/.next/server/chunks/{_next-internal_server_app_api_config_route_actions_308a9f33.js.map → 0zjb_server_app_api_ide_openclaw_available-models_route_actions_0.gjr6a.js.map} +0 -0
  657. /package/.next/server/chunks/{_next-internal_server_app_api_gateway_[___path]_route_actions_835b2379.js.map → 0zjb_server_app_api_ide_opencode_available-models_route_actions_0poyhyk.js.map} +0 -0
  658. /package/.next/server/chunks/{_next-internal_server_app_api_gateway_models_route_actions_302c9983.js.map → _next-internal_server_app_api_config_route_actions_08dm.dx.js.map} +0 -0
  659. /package/.next/server/chunks/{_next-internal_server_app_api_gateway_route_actions_e5e7405d.js.map → _next-internal_server_app_api_gateway_[___path]_route_actions_0mmqyo7.js.map} +0 -0
  660. /package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_apply_route_actions_5056516c.js.map → _next-internal_server_app_api_gateway_models_route_actions_08b214z.js.map} +0 -0
  661. /package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_available-models_route_actions_94d710a0.js.map → _next-internal_server_app_api_gateway_route_actions_0.jzdw1.js.map} +0 -0
  662. /package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_restore_route_actions_f37acc94.js.map → _next-internal_server_app_api_ide_claude_apply_route_actions_0dw2_pf.js.map} +0 -0
  663. /package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_save_route_actions_407c55f5.js.map → _next-internal_server_app_api_ide_claude_available-models_route_actions_0pmwy75.js.map} +0 -0
  664. /package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_status_route_actions_5ac73db8.js.map → _next-internal_server_app_api_ide_claude_restore_route_actions_11x77hl.js.map} +0 -0
  665. /package/.next/server/chunks/{_next-internal_server_app_api_ide_claude_test_route_actions_70587902.js.map → _next-internal_server_app_api_ide_claude_save_route_actions_0b35ro_.js.map} +0 -0
  666. /package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_apply_route_actions_2cb9e4b4.js.map → _next-internal_server_app_api_ide_claude_status_route_actions_0fnw-w7.js.map} +0 -0
  667. /package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_preview_route_actions_9814a8e4.js.map → _next-internal_server_app_api_ide_claude_test_route_actions_0jc1czy.js.map} +0 -0
  668. /package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_restore_route_actions_10ad8f9d.js.map → _next-internal_server_app_api_ide_openclaw_apply_route_actions_07re971.js.map} +0 -0
  669. /package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_save_route_actions_044ad081.js.map → _next-internal_server_app_api_ide_openclaw_preview_route_actions_0q53p05.js.map} +0 -0
  670. /package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_status_route_actions_ed9786d2.js.map → _next-internal_server_app_api_ide_openclaw_restore_route_actions_02yog9-.js.map} +0 -0
  671. /package/.next/server/chunks/{_next-internal_server_app_api_ide_openclaw_test_route_actions_ce2cb808.js.map → _next-internal_server_app_api_ide_openclaw_save_route_actions_00tjxsz.js.map} +0 -0
  672. /package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_apply_route_actions_6c422244.js.map → _next-internal_server_app_api_ide_openclaw_status_route_actions_10wsun4.js.map} +0 -0
  673. /package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_preview_route_actions_256c82e0.js.map → _next-internal_server_app_api_ide_openclaw_test_route_actions_0zgwyon.js.map} +0 -0
  674. /package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_restore_route_actions_371993d3.js.map → _next-internal_server_app_api_ide_opencode_apply_route_actions_0in-w.g.js.map} +0 -0
  675. /package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_save_route_actions_6e4c9c41.js.map → _next-internal_server_app_api_ide_opencode_preview_route_actions_06h6.w~.js.map} +0 -0
  676. /package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_status_route_actions_498ad77b.js.map → _next-internal_server_app_api_ide_opencode_restore_route_actions_09ipt-l.js.map} +0 -0
  677. /package/.next/server/chunks/{_next-internal_server_app_api_ide_opencode_test_route_actions_c71be510.js.map → _next-internal_server_app_api_ide_opencode_save_route_actions_0i-~x79.js.map} +0 -0
  678. /package/.next/server/chunks/{_next-internal_server_app_api_logs_route_actions_30a87f47.js.map → _next-internal_server_app_api_ide_opencode_status_route_actions_0cpf6rv.js.map} +0 -0
  679. /package/.next/server/chunks/{_next-internal_server_app_api_models_route_actions_b6abdc83.js.map → _next-internal_server_app_api_ide_opencode_test_route_actions_0y8aq8h.js.map} +0 -0
  680. /package/.next/server/chunks/{_next-internal_server_app_api_providers_route_actions_5388b373.js.map → _next-internal_server_app_api_logs_route_actions_08ef2j7.js.map} +0 -0
  681. /package/.next/server/chunks/{_next-internal_server_app_api_providers_test_route_actions_b97ab15a.js.map → _next-internal_server_app_api_models_route_actions_0vfccm4.js.map} +0 -0
  682. /package/.next/server/chunks/{_next-internal_server_app_api_service_force-stop_route_actions_95eba80b.js.map → _next-internal_server_app_api_providers_route_actions_0ee1p_m.js.map} +0 -0
  683. /package/.next/server/chunks/{_next-internal_server_app_api_service_start_route_actions_d50efb77.js.map → _next-internal_server_app_api_providers_test_route_actions_0vyo652.js.map} +0 -0
  684. /package/.next/server/chunks/{_next-internal_server_app_api_service_status_route_actions_30149042.js.map → _next-internal_server_app_api_service_force-stop_route_actions_0pu9xrq.js.map} +0 -0
  685. /package/.next/server/chunks/{_next-internal_server_app_api_service_stop_route_actions_19443941.js.map → _next-internal_server_app_api_service_start_route_actions_0_o53a2.js.map} +0 -0
  686. /package/.next/server/chunks/{ce889_server_app_api_ide_openclaw_available-models_route_actions_e568e70b.js.map → _next-internal_server_app_api_service_status_route_actions_08ag8v4.js.map} +0 -0
  687. /package/.next/server/chunks/{ce889_server_app_api_ide_opencode_available-models_route_actions_95230db3.js.map → _next-internal_server_app_api_service_stop_route_actions_04dp83p.js.map} +0 -0
  688. /package/.next/server/chunks/{ssr/_next-internal_server_app__global-error_page_actions_75761787.js.map → _next-internal_server_app_api_tokenizer_history_route_actions_09~nqtd.js.map} +0 -0
  689. /package/.next/server/chunks/{ssr/_next-internal_server_app__not-found_page_actions_554ec2bf.js.map → _next-internal_server_app_api_tokenizer_test_route_actions_0t2swp-.js.map} +0 -0
  690. /package/.next/server/chunks/ssr/{_next-internal_server_app_ide_page_actions_d521d6ae.js.map → _next-internal_server_app__global-error_page_actions_0k77kol.js.map} +0 -0
  691. /package/.next/server/chunks/ssr/{_next-internal_server_app_logs_page_actions_a1c69041.js.map → _next-internal_server_app__not-found_page_actions_0eq97pa.js.map} +0 -0
  692. /package/.next/server/chunks/ssr/{_next-internal_server_app_models_page_actions_543cf22f.js.map → _next-internal_server_app_ide_page_actions_0_opd4~.js.map} +0 -0
  693. /package/.next/server/chunks/ssr/{_next-internal_server_app_page_actions_39d4fc33.js.map → _next-internal_server_app_logs_page_actions_0rvsl~d.js.map} +0 -0
  694. /package/.next/server/chunks/ssr/{_next-internal_server_app_providers_page_actions_c75f6cb3.js.map → _next-internal_server_app_models_page_actions_0eiz7f7.js.map} +0 -0
  695. /package/.next/server/chunks/ssr/{node_modules_next_dist_client_components_9774470f._.js.map → node_modules_next_dist_client_components_0inhx6q._.js.map} +0 -0
  696. /package/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_forbidden_45780354.js.map → node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js.map} +0 -0
  697. /package/.next/server/chunks/ssr/{node_modules_next_dist_client_components_builtin_unauthorized_15817684.js.map → node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js.map} +0 -0
  698. /package/.next/static/{cf2SWIkI5HVbnDjLExI42 → XHnu7Z1vWSrgmneps8rX4}/_buildManifest.js +0 -0
  699. /package/.next/static/{cf2SWIkI5HVbnDjLExI42 → XHnu7Z1vWSrgmneps8rX4}/_ssgManifest.js +0 -0
  700. /package/.next/static/chunks/{a6dad97d9634a72d.js → 03~yq9q893hmn.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/app/api/ide/openclaw/available-models/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getAllModels, getProviderById } from '@/db/queries';\n\ntype AvailableModel = {\n id: number;\n name: string;\n model_id: string;\n provider_id: number;\n provider_name: string;\n enabled: boolean;\n};\n\ntype GroupedModels = { [providerName: string]: AvailableModel[] };\n\n/**\n * 查询可用模型列表(与 Claude 共用网关,用于 OpenCode 配置)\n */\nexport async function GET(request: NextRequest) {\n try {\n const allModels = (await getAllModels()).filter((m: any) => m.enabled);\n\n if (allModels.length === 0) {\n return NextResponse.json({\n models: {},\n count: 0,\n message: 'No enabled models found. Please enable some models first.',\n });\n }\n\n const grouped = await allModels.reduce(async (acc: Promise<GroupedModels>, model: any) => {\n const resolvedAcc = await acc;\n const provider = await getProviderById(model.provider_id);\n if (provider) {\n if (!resolvedAcc[provider.name]) resolvedAcc[provider.name] = [];\n resolvedAcc[provider.name].push({\n id: model.id,\n name: model.name,\n model_id: model.model_id,\n provider_id: model.provider_id,\n provider_name: provider.name,\n enabled: model.enabled,\n });\n }\n return resolvedAcc;\n }, Promise.resolve({} as GroupedModels));\n\n return NextResponse.json({\n models: grouped,\n count: allModels.length,\n providers: Object.keys(grouped),\n });\n } catch (error: any) {\n console.error('OpenCode Available Models API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/ide/openclaw/available-models/route\",\n pathname: \"/api/ide/openclaw/available-models\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/ide/openclaw/available-models/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/ide/openclaw/available-models/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["provider","GET","request","allModels","filter","m","enabled","length","message","json","models","count","grouped","reduce","acc","model","resolvedAcc","provider_id","name","push","id","model_id","provider_name","Promise","resolve","providers","Object","keys","error","console","stack","undefined","status"],"mappings":"8iCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACAA,EAAAA,EAAAA,CAAAA,CAAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAgBO,eAAeC,EAAIC,CAAoB,EAC5C,GAAI,CACF,IAAMC,EAAY,CAAC,MAAM,CAAA,EAAA,EAAA,YAAY,AAAZ,GAAY,CAAE,CAAEC,MAAM,CAAC,AAACC,GAAWA,EAAEC,OAAO,EAErE,GAAyB,GAAG,CAAxBH,EAAUI,MAAM,CAClB,OAAO,EAAA,YAAY,CAACE,IAAI,CAAC,CACvBC,OAAQ,CAAC,EACTC,MAAO,EACPH,QAAS,2DACX,GAGF,IAAMI,EAAU,MAAMT,EAAUU,MAAM,CAAC,MAAOC,EAA6BC,KACzE,IAAMC,EAA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AAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,CAGI,IAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,CAClC,0CACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAY,AAAZ,EAAa,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[1]}
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},50491,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),v=e.i(26937),x=e.i(10372),m=e.i(93695);e.i(52474);var R=e.i(220),g=e.i(89171),f=e.i(97731);async function w(e){try{let e=(await (0,f.getAllModels)()).filter(e=>e.enabled);if(0===e.length)return g.NextResponse.json({models:{},count:0,message:"No enabled models found. Please enable some models first."});let t=await e.reduce(async(e,t)=>{let r=await e,a=await (0,f.getProviderById)(t.provider_id);return a&&(r[a.name]||(r[a.name]=[]),r[a.name].push({id:t.id,name:t.name,model_id:t.model_id,provider_id:t.provider_id,provider_name:a.name,enabled:t.enabled})),r},Promise.resolve({})),r=Object.keys(t);return g.NextResponse.json({models:t,count:e.length,providers:r})}catch(e){return console.error("Available Models API error:",e),g.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["GET",0,w],80064);var E=e.i(80064);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/claude/available-models/route",pathname:"/api/ide/claude/available-models",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/claude/available-models/route.ts",nextConfigOutput:"",userland:E}),{workAsyncStorage:y,workUnitAsyncStorage:C,serverHooks:A}=b;async function N(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/ide/claude/available-models/route";g=g.replace(/\/index$/,"")||"/";let f=await b.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,params:E,nextConfig:y,parsedUrl:C,isDraftMode:A,prerenderManifest:N,routerServerContext:P,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,resolvedPathname:q,clientReferenceManifest:k,serverActionsManifest:O}=f,S=(0,i.normalizeAppPath)(g),j=!!(N.dynamicRoutes[S]||N.routes[q]),I=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,C,!1):t.end("This page could not be found"),null);if(j&&!A){let e=!!N.routes[q],t=N.dynamicRoutes[S];if(t&&!1===t.fallback&&!e){if(y.adapterPath)return await I();throw new m.NoFallbackError}}let H=null;!j||b.isDev||A||(H="/index"===(H=q)?"/":H);let M=!0===b.isDev||!j,U=j&&!M;O&&k&&(0,o.setManifestsSingleton)({page:g,clientReferenceManifest:k,serverActionsManifest:O});let D=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),K=!!(null==P?void 0:P.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),L=(0,n.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,y,N,B);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let G={params:E,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:M,incrementalCache:L,cacheLifeProfiles:y.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,P)},sharedContext:{buildId:w}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t));try{let n,o=async e=>b.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${D} ${g}`)}),i=async n=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!B&&_&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let i=G.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=G.renderOpts.collectedTags;if(!j)return await (0,c.sendResponse)(V,W,s,G.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,a=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:_})},!1,P),t}},d=await b.handleResponse({req:e,nextConfig:y,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:B});if(!j)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",_?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&j||u.delete(x.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,v.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(V,W,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&F?await i(F):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${D} ${g}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},i),void 0,!K))}catch(t){if(t instanceof m.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:_})},!1,P),j)throw t;return await (0,c.sendResponse)(V,W,new Response(null,{status:500})),null}}e.s(["handler",0,N,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:C})},"routeModule",0,b,"serverHooks",0,A,"workAsyncStorage",0,y,"workUnitAsyncStorage",0,C],50491)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__08oq8ma._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/app/api/ide/claude/available-models/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getAllModels, getProviderById } from '@/db/queries';\n\ntype AvailableModel = {\n id: number;\n name: string;\n model_id: string;\n provider_id: number;\n provider_name: string;\n enabled: boolean;\n};\n\ntype GroupedModels = {\n [providerName: string]: AvailableModel[];\n};\n\n/**\n * 查询可用模型列表(用于 IDE 配置)\n */\nexport async function GET(request: NextRequest) {\n try {\n // 获取所有已启用的模型\n const allModels = (await getAllModels()).filter((m: any) => m.enabled);\n\n if (allModels.length === 0) {\n return NextResponse.json({\n models: {},\n count: 0,\n message: 'No enabled models found. Please enable some models first.',\n });\n }\n\n // 按供应商分组\n const grouped = await allModels.reduce(async (acc: Promise<GroupedModels>, model: any) => {\n const resolvedAcc = await acc;\n const provider = await getProviderById(model.provider_id);\n if (provider) {\n if (!resolvedAcc[provider.name]) {\n resolvedAcc[provider.name] = [];\n }\n resolvedAcc[provider.name].push({\n id: model.id,\n name: model.name,\n model_id: model.model_id,\n provider_id: model.provider_id,\n provider_name: provider.name,\n enabled: model.enabled,\n });\n }\n return resolvedAcc;\n }, Promise.resolve({} as GroupedModels));\n\n const providers = Object.keys(grouped);\n\n return NextResponse.json({\n models: grouped,\n count: allModels.length,\n providers,\n });\n } catch (error: any) {\n console.error('Available Models API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/ide/claude/available-models/route\",\n pathname: \"/api/ide/claude/available-models\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/ide/claude/available-models/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/ide/claude/available-models/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["GET","request","allModels","filter","m","enabled","json","length","models","count","message","grouped","reduce","acc","model","resolvedAcc","provider","provider_id","name","push","id","model_id","provider_name","Promise","resolve","providers","Object","keys","error","console","stack","undefined","status"],"mappings":"8iCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAkBO,eAAeA,EAAIC,CAAoB,EAC5C,GAAI,CAEF,IAAMC,EAAY,CAAC,MAAM,CAAA,EAAA,EAAA,YAAY,AAAZ,GAAY,CAAE,CAAEC,MAAM,CAAC,AAACC,GAAWA,EAAEC,OAAO,EAErE,GAAyB,GAAG,CAAxBH,EAAUK,MAAM,CAClB,OAAO,EAAA,YAAY,CAACD,IAAI,CAAC,CACvBE,OAAQ,CAAC,EACTC,MAAO,EACPC,QAAS,2DACX,GAIF,IAAMC,EAAU,MAAMT,EAAUU,MAAM,CAAC,MAAOC,EAA6BC,KACzE,IAAMC,EAAc,MAAMF,EACpBG,EAAW,MAAM,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KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,GAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,EACA,sBACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[1]}
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},11145,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),o=e.i(61916),s=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),v=e.i(26937),x=e.i(10372),m=e.i(93695);e.i(52474);var R=e.i(220),g=e.i(89171),f=e.i(97731);async function w(e){try{let e=(await (0,f.getAllModels)()).filter(e=>e.enabled);if(0===e.length)return g.NextResponse.json({models:{},count:0,message:"No enabled models found. Please enable some models first."});let t=await e.reduce(async(e,t)=>{let r=await e,a=await (0,f.getProviderById)(t.provider_id);return a&&(r[a.name]||(r[a.name]=[]),r[a.name].push({id:t.id,name:t.name,model_id:t.model_id,provider_id:t.provider_id,provider_name:a.name,enabled:t.enabled})),r},Promise.resolve({}));return g.NextResponse.json({models:t,count:e.length,providers:Object.keys(t)})}catch(e){return console.error("OpenCode Available Models API error:",e),g.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["GET",0,w],29296);var E=e.i(29296);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/opencode/available-models/route",pathname:"/api/ide/opencode/available-models",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/opencode/available-models/route.ts",nextConfigOutput:"",userland:E}),{workAsyncStorage:y,workUnitAsyncStorage:C,serverHooks:A}=b;async function N(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/ide/opencode/available-models/route";g=g.replace(/\/index$/,"")||"/";let f=await b.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,params:E,nextConfig:y,parsedUrl:C,isDraftMode:A,prerenderManifest:N,routerServerContext:P,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,resolvedPathname:q,clientReferenceManifest:k,serverActionsManifest:O}=f,S=(0,i.normalizeAppPath)(g),j=!!(N.dynamicRoutes[S]||N.routes[q]),I=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,C,!1):t.end("This page could not be found"),null);if(j&&!A){let e=!!N.routes[q],t=N.dynamicRoutes[S];if(t&&!1===t.fallback&&!e){if(y.adapterPath)return await I();throw new m.NoFallbackError}}let H=null;!j||b.isDev||A||(H="/index"===(H=q)?"/":H);let M=!0===b.isDev||!j,U=j&&!M;O&&k&&(0,s.setManifestsSingleton)({page:g,clientReferenceManifest:k,serverActionsManifest:O});let D=e.method||"GET",$=(0,o.getTracer)(),F=$.getActiveScopeSpan(),K=!!(null==P?void 0:P.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),L=(0,n.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,y,N,B);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let G={params:E,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:M,incrementalCache:L,cacheLifeProfiles:y.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,P)},sharedContext:{buildId:w}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t));try{let n,s=async e=>b.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${D} ${g}`)}),i=async n=>{var o,i;let l=async({previousCacheEntry:r})=>{try{if(!B&&_&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await s(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let i=G.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=G.renderOpts.collectedTags;if(!j)return await (0,c.sendResponse)(V,W,o,G.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,a=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:_})},!1,P),t}},d=await b.handleResponse({req:e,nextConfig:y,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:B});if(!j)return null;if((null==d||null==(o=d.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",_?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&j||u.delete(x.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,v.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(V,W,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&F?await i(F):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${D} ${g}`,kind:o.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},i),void 0,!K))}catch(t){if(t instanceof m.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:_})},!1,P),j)throw t;return await (0,c.sendResponse)(V,W,new Response(null,{status:500})),null}}e.s(["handler",0,N,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:C})},"routeModule",0,b,"serverHooks",0,A,"workAsyncStorage",0,y,"workUnitAsyncStorage",0,C],11145)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__099b1my._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/app/api/ide/opencode/available-models/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getAllModels, getProviderById } from '@/db/queries';\n\ntype AvailableModel = {\n id: number;\n name: string;\n model_id: string;\n provider_id: number;\n provider_name: string;\n enabled: boolean;\n};\n\ntype GroupedModels = { [providerName: string]: AvailableModel[] };\n\n/**\n * 查询可用模型列表(与 Claude 共用网关,用于 OpenCode 配置)\n */\nexport async function GET(request: NextRequest) {\n try {\n const allModels = (await getAllModels()).filter((m: any) => m.enabled);\n\n if (allModels.length === 0) {\n return NextResponse.json({\n models: {},\n count: 0,\n message: 'No enabled models found. Please enable some models first.',\n });\n }\n\n const grouped = await allModels.reduce(async (acc: Promise<GroupedModels>, model: any) => {\n const resolvedAcc = await acc;\n const provider = await getProviderById(model.provider_id);\n if (provider) {\n if (!resolvedAcc[provider.name]) resolvedAcc[provider.name] = [];\n resolvedAcc[provider.name].push({\n id: model.id,\n name: model.name,\n model_id: model.model_id,\n provider_id: model.provider_id,\n provider_name: provider.name,\n enabled: model.enabled,\n });\n }\n return resolvedAcc;\n }, Promise.resolve({} as GroupedModels));\n\n return NextResponse.json({\n models: grouped,\n count: allModels.length,\n providers: Object.keys(grouped),\n });\n } catch (error: any) {\n console.error('OpenCode Available Models API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/ide/opencode/available-models/route\",\n pathname: \"/api/ide/opencode/available-models\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/ide/opencode/available-models/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/ide/opencode/available-models/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["provider","GET","request","allModels","filter","m","enabled","length","message","json","models","count","grouped","reduce","acc","model","resolvedAcc","provider_id","name","push","id","model_id","provider_name","Promise","resolve","providers","Object","keys","error","console","stack","undefined","status"],"mappings":"8iCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACAA,EAAAA,EAAAA,CAAAA,CAAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAgBO,eAAeC,EAAIC,CAAoB,EAC5C,GAAI,CACF,IAAMC,EAAY,CAAC,MAAM,CAAA,EAAA,EAAA,YAAY,AAAZ,GAAY,CAAE,CAAEC,MAAM,CAAC,AAACC,GAAWA,EAAEC,OAAO,EAErE,GAAyB,GAAG,CAAxBH,EAAUI,MAAM,CAClB,OAAO,EAAA,YAAY,CAACE,IAAI,CAAC,CACvBC,OAAQ,CAAC,EACTC,MAAO,EACPH,QAAS,2DACX,GAGF,IAAMI,EAAU,MAAMT,EAAUU,MAAM,CAAC,MAAOC,EAA6BC,KACzE,IAAMC,EAAc,MAAMF,EACpBd,EAAW,MAAM,CAAA,EAAA,EAAA,eAAA,A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GI,IAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,CAClC,0CACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAY,AAAZ,EAAa,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[1]}
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},24361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},4446,(e,t,r)=>{t.exports=e.x("net",()=>require("net"))},77922,e=>{"use strict";var t=e.i(33405),r=e.i(24361),s=e.i(14747),a=e.i(97731),o=e.i(71560),i=e.i(4446);let n=(0,r.promisify)(t.exec),l=new class{gatewayProcess=null;isStarting=!1;async checkProcessExists(e){try{return await n(`ps -p ${e} -o pid=`),!0}catch{return!1}}async checkPortAvailable(e){return new Promise(t=>{let r=i.default.createServer();r.listen(e,()=>{r.once("close",()=>t(!0)),r.close()}),r.on("error",()=>{t(!1)})})}async getPidByPort(e){try{let{stdout:t}=await n(`lsof -ti:${e} 2>/dev/null || echo ''`),r=t.trim();if(r&&!isNaN(parseInt(r)))return parseInt(r);try{let{stdout:t}=await n(`netstat -tlnp 2>/dev/null | grep :${e} | awk '{print $7}' | cut -d'/' -f1 || echo ''`),r=t.trim();if(r&&!isNaN(parseInt(r)))return parseInt(r)}catch{}return null}catch{return null}}async forceKillProcess(e){try{try{process.kill(e,"SIGTERM"),await new Promise(e=>setTimeout(e,1e3))}catch{}if(await this.checkProcessExists(e))try{process.kill(e,"SIGKILL"),await new Promise(e=>setTimeout(e,500))}catch{}return!await this.checkProcessExists(e)}catch(t){return console.error(`Failed to kill process ${e}:`,t),!1}}async killProcessByPort(e){return this.forceKillProcessByPort(e)}async forceKillProcessByPort(e){let t=await this.getPidByPort(e);if(!t)return!0;console.log(`Found process ${t} using port ${e}, attempting to kill...`);let r=await this.forceKillProcess(t);return r?console.log(`Successfully killed process ${t}`):console.warn(`Failed to kill process ${t}`),r}async getStatus(){let e=await (0,a.getServiceStatus)();return e?"running"===e.status&&e.pid&&!await this.checkProcessExists(e.pid)?(await (0,a.updateServiceStatus)({status:"stopped",pid:null}),{status:"stopped"}):{status:e.status,port:e.port,pid:e.pid,started_at:e.started_at}:{status:"stopped"}}async start(e){if(this.isStarting)return{status:"stopped",error:"Service is already starting"};let r=await this.getStatus();if("running"===r.status&&r.port===e)return{status:"running",error:"Service is already running",port:r.port,pid:r.pid};if(!await this.checkPortAvailable(e)){if(console.log(`Port ${e} is in use, attempting to free it...`),await this.killProcessByPort(e),await new Promise(e=>setTimeout(e,1e3)),!await this.checkPortAvailable(e))return{status:"stopped",error:`Port ${e} is still in use after cleanup attempt`};console.log(`Port ${e} is now available`)}this.isStarting=!0;try{try{await (0,o.getDatabase)()}catch(e){return console.error("Failed to initialize database:",e),this.isStarting=!1,{status:"stopped",error:"Failed to initialize database"}}let r=s.default.join(process.cwd(),"dist","src","cli","gateway-server.js"),i=(0,t.spawn)(process.execPath,[r,"--port",e.toString()],{cwd:process.cwd(),stdio:["ignore","pipe","pipe"],env:{...process.env,NODE_ENV:"production"}});i.stdout&&i.stdout.on("data",e=>{process.stdout.write(`[Gateway] ${e}`)}),i.stderr&&i.stderr.on("data",e=>{process.stderr.write(`[Gateway Error] ${e}`)}),i.on("exit",async e=>{console.log(`Gateway process exited with code ${e}`),this.gatewayProcess===i&&(this.gatewayProcess=null,await (0,a.updateServiceStatus)({status:"stopped",pid:null}))}),i.on("error",e=>{console.error(`Failed to start gateway process: ${e.message}`)}),this.gatewayProcess=i;let n=i.pid||null,l=new Date().toISOString();return await (0,a.setServiceStatus)({status:"running",port:e,pid:n,started_at:l}),this.isStarting=!1,console.log(`Gateway server started on port ${e} (PID: ${n})`),{status:"running",port:e,pid:n,started_at:l}}catch(e){return this.isStarting=!1,this.gatewayProcess=null,console.error(`Failed to start gateway service: ${e.message}`),{status:"stopped",error:e.message||"Failed to start service"}}}async stop(){let e=await this.getStatus();if("stopped"===e.status)return{status:"stopped"};let t=e.port||parseInt((await (0,a.getConfig)("port"))?.value||"1357");try{if(this.gatewayProcess&&this.gatewayProcess.pid){let e=this.gatewayProcess.pid;console.log(`Attempting to kill gateway process (PID: ${e})`);try{process.kill(e,"SIGTERM"),console.log(`Sent SIGTERM to process ${e}`),await new Promise(e=>setTimeout(e,1e3))}catch(t){"ESRCH"===t.code?console.log(`Process ${e} already dead (ESRCH)`):console.log(`SIGTERM failed for process ${e}: ${t.message}`)}if(await this.checkProcessExists(e)){console.log(`Process ${e} still exists after SIGTERM, sending SIGKILL`);try{process.kill(e,"SIGKILL"),await new Promise(e=>setTimeout(e,500))}catch(t){"ESRCH"===t.code?console.log(`Process ${e} already dead (ESRCH)`):console.log(`SIGKILL failed for process ${e}: ${t.message}`)}}await this.checkProcessExists(e)?console.warn(`Process ${e} still exists after kill attempts`):console.log(`Successfully killed gateway process ${e}`),this.gatewayProcess=null}if(await new Promise(e=>setTimeout(e,500)),!await this.checkPortAvailable(t)&&(console.log(`Port ${t} still in use, attempting to free it...`),await this.killProcessByPort(t),await new Promise(e=>setTimeout(e,1e3)),!await this.checkPortAvailable(t)))return console.error(`Failed to free port ${t} - it may be in TIME_WAIT state`),{status:"stopped",error:`Port ${t} is still in use. It may be in TIME_WAIT state and will be available shortly.`};return await (0,a.updateServiceStatus)({status:"stopped",pid:null}),this.gatewayProcess=null,console.log("Gateway service stopped"),{status:"stopped"}}catch(e){return await (0,a.updateServiceStatus)({status:"stopped",pid:null}),this.gatewayProcess=null,{status:"stopped",error:e.message||"Failed to stop service"}}}};e.s(["serviceManager",0,l])},48267,e=>{"use strict";var t=e.i(47909),r=e.i(74017),s=e.i(96250),a=e.i(59756),o=e.i(61916),i=e.i(74677),n=e.i(69741),l=e.i(16795),c=e.i(87718),u=e.i(95169),p=e.i(47587),d=e.i(66012),h=e.i(70101),g=e.i(26937),w=e.i(10372),y=e.i(93695);e.i(52474);var v=e.i(220),x=e.i(89171),f=e.i(77922);async function P(e){try{let t=await e.json().catch(()=>({})),r=t.port?parseInt(t.port,10):1357;if(console.log(`Force killing process on port ${r}...`),await f.serviceManager.killProcessByPort(r))return x.NextResponse.json({success:!0,message:`Successfully freed port ${r}`});return x.NextResponse.json({success:!1,error:`Failed to free port ${r}`})}catch(e){return console.error("Force kill API error:",e),x.NextResponse.json({success:!1,error:e.message||"Internal server error"},{status:500})}}e.s(["POST",0,P,"runtime",0,"nodejs"],67344);var m=e.i(67344);let R=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/service/force-stop/route",pathname:"/api/service/force-stop",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/service/force-stop/route.ts",nextConfigOutput:"",userland:m}),{workAsyncStorage:S,workUnitAsyncStorage:E,serverHooks:k}=R;async function I(e,t,s){s.requestMeta&&(0,a.setRequestMeta)(e,s.requestMeta),R.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/service/force-stop/route";x=x.replace(/\/index$/,"")||"/";let f=await R.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:P,params:m,nextConfig:S,parsedUrl:E,isDraftMode:k,prerenderManifest:I,routerServerContext:$,isOnDemandRevalidate:b,revalidateOnlyGenerated:C,resolvedPathname:T,clientReferenceManifest:A,serverActionsManifest:N}=f,_=(0,n.normalizeAppPath)(x),q=!!(I.dynamicRoutes[_]||I.routes[T]),j=async()=>((null==$?void 0:$.render404)?await $.render404(e,t,E,!1):t.end("This page could not be found"),null);if(q&&!k){let e=!!I.routes[T],t=I.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(S.adapterPath)return await j();throw new y.NoFallbackError}}let M=null;!q||R.isDev||k||(M="/index"===(M=T)?"/":M);let O=!0===R.isDev||!q,F=q&&!O;N&&A&&(0,i.setManifestsSingleton)({page:x,clientReferenceManifest:A,serverActionsManifest:N});let H=e.method||"GET",D=(0,o.getTracer)(),G=D.getActiveScopeSpan(),K=!!(null==$?void 0:$.isWrappedByNextServer),U=!!(0,a.getRequestMeta)(e,"minimalMode"),B=(0,a.getRequestMeta)(e,"incrementalCache")||await R.getIncrementalCache(e,S,I,U);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let L={params:m,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!S.experimental.authInterrupts},cacheComponents:!!S.cacheComponents,supportsDynamicResponse:O,incrementalCache:B,cacheLifeProfiles:S.cacheLife,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s,a)=>R.onRequestError(e,t,s,a,$)},sharedContext:{buildId:P}},W=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),z=c.NextRequestAdapter.fromNodeNextRequest(W,(0,c.signalFromNodeResponse)(t));try{let a,i=async e=>R.handle(z,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=D.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=r.get("next.route");if(s){let t=`${H} ${s}`;e.setAttributes({"next.route":s,"http.route":s,"next.span_name":t}),e.updateName(t),a&&a!==e&&(a.setAttribute("http.route",s),a.updateName(t))}else e.updateName(`${H} ${x}`)}),n=async a=>{var o,n;let l=async({previousCacheEntry:r})=>{try{if(!U&&b&&C&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(a);e.fetchMetrics=L.renderOpts.fetchMetrics;let n=L.renderOpts.pendingWaitUntil;n&&s.waitUntil&&(s.waitUntil(n),n=void 0);let l=L.renderOpts.collectedTags;if(!q)return await (0,d.sendResponse)(W,V,o,L.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[w.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=w.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,s=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=w.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await R.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:b})},!1,$),t}},c=await R.handleResponse({req:e,nextConfig:S,cacheKey:M,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:C,responseGenerator:l,waitUntil:s.waitUntil,isMinimalMode:U});if(!q)return null;if((null==c||null==(o=c.value)?void 0:o.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(n=c.value)?void 0:n.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});U||t.setHeader("x-nextjs-cache",b?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),k&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(c.value.headers);return U&&q||u.delete(w.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,g.getCacheControlHeader)(c.cacheControl)),await (0,d.sendResponse)(W,V,new Response(c.value.body,{headers:u,status:c.value.status||200})),null};K&&G?await n(G):(a=D.getActiveScopeSpan(),await D.withPropagatedContext(e.headers,()=>D.trace(u.BaseServerSpan.handleRequest,{spanName:`${H} ${x}`,kind:o.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},n),void 0,!K))}catch(t){if(t instanceof y.NoFallbackError||await R.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:b})},!1,$),q)throw t;return await (0,d.sendResponse)(W,V,new Response(null,{status:500})),null}}e.s(["handler",0,I,"patchFetch",0,function(){return(0,s.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:E})},"routeModule",0,R,"serverHooks",0,k,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,E],48267)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0aw-~h8._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/server/service-manager.ts","../../../src/app/api/service/force-stop/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { exec, execSync, spawn, ChildProcess } from 'child_process';\nimport { promisify } from 'util';\nimport path from 'path';\nimport { getServiceStatus, setServiceStatus, updateServiceStatus, getConfig } from '@/db/queries';\nimport { getDatabase } from '@/db/database';\nimport net from 'net';\n\nconst execAsync = promisify(exec);\n\nexport interface ServiceStatusResponse {\n status: 'running' | 'stopped';\n port?: number;\n pid?: number | null;\n started_at?: string | null;\n error?: string;\n}\n\nclass ServiceManager {\n private gatewayProcess: ChildProcess | null = null;\n private isStarting: boolean = false;\n\n /**\n * Check if a process with given PID exists\n */\n private async checkProcessExists(pid: number): Promise<boolean> {\n try {\n await execAsync(`ps -p ${pid} -o pid=`);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Check if a port is available\n */\n private async checkPortAvailable(port: number): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer();\n\n server.listen(port, () => {\n server.once('close', () => resolve(true));\n server.close();\n });\n\n server.on('error', () => {\n resolve(false);\n });\n });\n }\n\n /**\n * Get PID using a specific port\n */\n private async getPidByPort(port: number): Promise<number | null> {\n try {\n // Try lsof first (macOS/Linux)\n const { stdout } = await execAsync(`lsof -ti:${port} 2>/dev/null || echo ''`);\n const pid = stdout.trim();\n if (pid && !isNaN(parseInt(pid))) {\n return parseInt(pid);\n }\n\n // Try netstat as fallback (some systems)\n try {\n const { stdout: netstatOut } = await execAsync(`netstat -tlnp 2>/dev/null | grep :${port} | awk '{print $7}' | cut -d'/' -f1 || echo ''`);\n const pid2 = netstatOut.trim();\n if (pid2 && !isNaN(parseInt(pid2))) {\n return parseInt(pid2);\n }\n } catch {\n // netstat might not be available\n }\n\n return null;\n } catch {\n return null;\n }\n }\n\n /**\n * Force kill a process by PID\n */\n private async forceKillProcess(pid: number): Promise<boolean> {\n try {\n // First try SIGTERM for graceful shutdown\n try {\n process.kill(pid, 'SIGTERM');\n // Give process time to terminate gracefully\n await new Promise(resolve => setTimeout(resolve, 1000));\n } catch {\n // Process might already be dead\n }\n\n // Check if process still exists\n if (await this.checkProcessExists(pid)) {\n // Try SIGKILL\n try {\n process.kill(pid, 'SIGKILL');\n await new Promise(resolve => setTimeout(resolve, 500));\n } catch {\n // Might fail if process already dead\n }\n }\n\n return !(await this.checkProcessExists(pid));\n } catch (error) {\n console.error(`Failed to kill process ${pid}:`, error);\n return false;\n }\n }\n\n /**\n * Kill process using a specific port (public method)\n */\n async killProcessByPort(port: number): Promise<boolean> {\n return this.forceKillProcessByPort(port);\n }\n\n /**\n * Force kill a process by PID (private helper)\n */\n private async forceKillProcessByPort(port: number): Promise<boolean> {\n const pid = await this.getPidByPort(port);\n if (!pid) {\n return true; // No process using the port\n }\n\n console.log(`Found process ${pid} using port ${port}, attempting to kill...`);\n const killed = await this.forceKillProcess(pid);\n \n if (killed) {\n console.log(`Successfully killed process ${pid}`);\n } else {\n console.warn(`Failed to kill process ${pid}`);\n }\n\n return killed;\n }\n\n /**\n * Get current service status, verifying process existence\n */\n async getStatus(): Promise<ServiceStatusResponse> {\n const dbStatus = await getServiceStatus();\n\n if (!dbStatus) {\n return { status: 'stopped' };\n }\n\n // If status is running, verify process actually exists\n if (dbStatus.status === 'running' && dbStatus.pid) {\n const processExists = await this.checkProcessExists(dbStatus.pid);\n if (!processExists) {\n // Process doesn't exist, update database\n await updateServiceStatus({ status: 'stopped', pid: null });\n return { status: 'stopped' };\n }\n }\n\n return {\n status: dbStatus.status,\n port: dbStatus.port,\n pid: dbStatus.pid,\n started_at: dbStatus.started_at,\n };\n }\n\n /**\n * Start gateway service\n */\n async start(port: number): Promise<ServiceStatusResponse> {\n // Prevent concurrent starts\n if (this.isStarting) {\n return { status: 'stopped', error: 'Service is already starting' };\n }\n\n // Check if service is already running\n const currentStatus = await this.getStatus();\n if (currentStatus.status === 'running' && currentStatus.port === port) {\n return { status: 'running', error: 'Service is already running', port: currentStatus.port, pid: currentStatus.pid };\n }\n\n // Check if port is available\n const portAvailable = await this.checkPortAvailable(port);\n if (!portAvailable) {\n console.log(`Port ${port} is in use, attempting to free it...`);\n\n // Try to kill the process using the port\n const killed = await this.killProcessByPort(port);\n\n // Wait for port to be released\n await new Promise(resolve => setTimeout(resolve, 1000));\n\n // Check again\n const portNowAvailable = await this.checkPortAvailable(port);\n if (!portNowAvailable) {\n return { status: 'stopped', error: `Port ${port} is still in use after cleanup attempt` };\n }\n\n console.log(`Port ${port} is now available`);\n }\n\n this.isStarting = true;\n\n try {\n // Initialize database\n try {\n await getDatabase();\n } catch (error: any) {\n console.error('Failed to initialize database:', error);\n this.isStarting = false;\n return { status: 'stopped', error: 'Failed to initialize database' };\n }\n\n // Get the path to the gateway server entry script\n const gatewayScriptPath = path.join(process.cwd(), 'dist', 'src', 'cli', 'gateway-server.js');\n\n // Spawn the gateway server in a separate process\n const gatewayProcess = spawn(process.execPath, [gatewayScriptPath, '--port', port.toString()], {\n cwd: process.cwd(),\n stdio: ['ignore', 'pipe', 'pipe'],\n env: { ...process.env, NODE_ENV: process.env.NODE_ENV || 'development' },\n });\n\n // Capture process output\n if (gatewayProcess.stdout) {\n gatewayProcess.stdout.on('data', (data) => {\n process.stdout.write(`[Gateway] ${data}`);\n });\n }\n if (gatewayProcess.stderr) {\n gatewayProcess.stderr.on('data', (data) => {\n process.stderr.write(`[Gateway Error] ${data}`);\n });\n }\n\n // Handle process exit\n gatewayProcess.on('exit', async (code) => {\n console.log(`Gateway process exited with code ${code}`);\n if (this.gatewayProcess === gatewayProcess) {\n this.gatewayProcess = null;\n await updateServiceStatus({ status: 'stopped', pid: null });\n }\n });\n\n gatewayProcess.on('error', (error) => {\n console.error(`Failed to start gateway process: ${error.message}`);\n });\n\n this.gatewayProcess = gatewayProcess;\n const pid = gatewayProcess.pid || null;\n const startedAt = new Date().toISOString();\n\n await setServiceStatus({\n status: 'running',\n port,\n pid,\n started_at: startedAt,\n });\n\n this.isStarting = false;\n\n console.log(`Gateway server started on port ${port} (PID: ${pid})`);\n\n return {\n status: 'running',\n port,\n pid,\n started_at: startedAt,\n };\n } catch (error: any) {\n this.isStarting = false;\n this.gatewayProcess = null;\n console.error(`Failed to start gateway service: ${error.message}`);\n return { status: 'stopped', error: error.message || 'Failed to start service' };\n }\n }\n\n /**\n * Stop the gateway service\n */\n async stop(): Promise<ServiceStatusResponse> {\n const currentStatus = await this.getStatus();\n\n if (currentStatus.status === 'stopped') {\n return { status: 'stopped' };\n }\n\n const port = currentStatus.port || parseInt((await getConfig('port'))?.value || '1357');\n\n try {\n // Track if we successfully killed something\n let killedSuccessfully = false;\n\n // Try to stop the gateway server process\n if (this.gatewayProcess && this.gatewayProcess.pid) {\n const pid = this.gatewayProcess.pid;\n console.log(`Attempting to kill gateway process (PID: ${pid})`);\n\n // First try SIGTERM for graceful shutdown\n try {\n process.kill(pid, 'SIGTERM');\n console.log(`Sent SIGTERM to process ${pid}`);\n // Give process time to terminate gracefully\n await new Promise(resolve => setTimeout(resolve, 1000));\n } catch (error: any) {\n if (error.code === 'ESRCH') {\n console.log(`Process ${pid} already dead (ESRCH)`);\n } else {\n console.log(`SIGTERM failed for process ${pid}: ${error.message}`);\n }\n }\n\n // Check if process still exists\n if (await this.checkProcessExists(pid)) {\n console.log(`Process ${pid} still exists after SIGTERM, sending SIGKILL`);\n try {\n process.kill(pid, 'SIGKILL');\n await new Promise(resolve => setTimeout(resolve, 500));\n } catch (error: any) {\n if (error.code === 'ESRCH') {\n console.log(`Process ${pid} already dead (ESRCH)`);\n } else {\n console.log(`SIGKILL failed for process ${pid}: ${error.message}`);\n }\n }\n }\n\n // Verify process is dead\n if (!(await this.checkProcessExists(pid))) {\n console.log(`Successfully killed gateway process ${pid}`);\n killedSuccessfully = true;\n } else {\n console.warn(`Process ${pid} still exists after kill attempts`);\n }\n\n this.gatewayProcess = null;\n }\n\n // Wait a bit for cleanup\n await new Promise(resolve => setTimeout(resolve, 500));\n\n // Check if port is still in use - if so, force kill by port\n const portStillInUse = !(await this.checkPortAvailable(port));\n\n if (portStillInUse) {\n console.log(`Port ${port} still in use, attempting to free it...`);\n const killed = await this.killProcessByPort(port);\n\n // Wait and verify\n await new Promise(resolve => setTimeout(resolve, 1000));\n\n const stillInUse = !(await this.checkPortAvailable(port));\n if (stillInUse) {\n console.error(`Failed to free port ${port} - it may be in TIME_WAIT state`);\n return {\n status: 'stopped',\n error: `Port ${port} is still in use. It may be in TIME_WAIT state and will be available shortly.`,\n };\n }\n\n killedSuccessfully = true;\n }\n\n // Update database status\n await updateServiceStatus({ status: 'stopped', pid: null });\n this.gatewayProcess = null;\n\n console.log('Gateway service stopped');\n return { status: 'stopped' };\n } catch (error: any) {\n // Even if there's an error, try to update status\n await updateServiceStatus({ status: 'stopped', pid: null });\n this.gatewayProcess = null;\n return { status: 'stopped', error: error.message || 'Failed to stop service' };\n }\n }\n}\n\n// Export singleton instance\nexport const serviceManager = new ServiceManager();\n","import { NextRequest, NextResponse } from 'next/server';\nimport { serviceManager } from '@/server/service-manager';\n\n// Ensure Node.js runtime\nexport const runtime = 'nodejs';\n\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json().catch(() => ({}));\n const port = body.port ? parseInt(body.port, 10) : 1357;\n\n console.log(`Force killing process on port ${port}...`);\n\n const killed = await serviceManager.killProcessByPort(port);\n\n if (killed) {\n return NextResponse.json({\n success: true,\n message: `Successfully freed port ${port}`,\n });\n } else {\n return NextResponse.json({\n success: false,\n error: `Failed to free port ${port}`,\n });\n }\n } catch (error: any) {\n console.error('Force kill API error:', error);\n return NextResponse.json(\n { success: false, error: error.message || 'Internal server error' },\n { status: 500 }\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/service/force-stop/route\",\n pathname: \"/api/service/force-stop\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/service/force-stop/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/service/force-stop/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["execAsync","ServiceManager","gatewayProcess","isStarting","checkProcessExists","pid","checkPortAvailable","port","Promise","resolve","server","createServer","listen","once","close","on","getPidByPort","stdout","trim","isNaN","parseInt","netstatOut","pid2","forceKillProcess","process","kill","setTimeout","error","console","killProcessByPort","forceKillProcessByPort","log","killed","warn","getStatus","dbStatus","status","processExists","started_at","start","currentStatus","portAvailable","portNowAvailable","gatewayScriptPath","join","cwd","execPath","toString","stdio","env","NODE_ENV","data","write","stderr","code","message","startedAt","Date","toISOString","stop","value","killedSuccessfully","portStillInUse","stillInUse","serviceManager","runtime","POST","request","body","json","catch","success"],"mappings":"8uCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAA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AAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[2]}
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,a)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,a)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,a)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,a)=>{t.exports=e.x("path",()=>require("path"))},68646,e=>{"use strict";var t=e.i(71560),a=e.i(97731);async function r(){await (0,t.getDatabase)();let e=await (0,a.getConfig)("port"),r=e?.value||"1357";return`http://localhost:${r}/v1`}async function n(){await (0,t.getDatabase)();let e=await (0,a.getConfig)("api_key");return e?.value||"your-gateway-api-key"}async function s(){return{baseUrl:await r(),apiKey:await n(),api:"openai-completions",models:(await (0,a.getAllModels)()).filter(e=>e.enabled).map(e=>({id:e.model_id,name:e.name,reasoning:e.reasoning||!1,input:e.input||["text"],cost:e.cost||{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:e.context_window||2e5,maxTokens:e.max_tokens||8192}))}}let i="aar-gateway";async function o(e,t){return function(e,t,a){let r=e&&"object"==typeof e?{...e}:{},n=r.models||{},s=n.providers||{};s[i]=a,n.providers=s,n.mode="merge",r.models=n;let o=r.agents||{},l=o.defaults||{},d=l.model||{},u=`${i}/${t.defaultModel}`,c=t.imageModel?`${i}/${t.imageModel}`:void 0;d.primary=u,t.defaultFallbacks&&t.defaultFallbacks.length>0?d.fallbacks=t.defaultFallbacks.map(e=>e.startsWith(`${i}/`)?e:`${i}/${e}`):delete d.fallbacks,l.model=d;let p=l.imageModel||{};c&&(p.primary=c),t.imageFallbacks&&t.imageFallbacks.length>0?p.fallbacks=t.imageFallbacks.map(e=>e.startsWith(`${i}/`)?e:`${i}/${e}`):delete p.fallbacks,l.imageModel=p;let f=l.models||{};for(let e of a.models){let t=`${i}/${e.id}`;f[t]=f[t]||{alias:e.name}}return l.models=f,o.defaults=l,r.agents=o,r.channels||(r.channels={}),r}(t,e,await s())}e.s(["buildMergedConfig",0,o])},17739,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),g=e.i(26937),m=e.i(10372),h=e.i(93695);e.i(52474);var x=e.i(220),v=e.i(89171),w=e.i(22734),y=e.i(14747),R=e.i(46786),b=e.i(68646);let C=(0,y.join)((0,R.homedir)(),".openclaw"),k=(0,y.join)(C,"openclaw.json"),E=(0,y.join)(C,"openclaw.json.aar.bak");async function A(e){try{let t,{default_model:a,default_fallbacks:r=[],image_model:n,image_fallbacks:s=[],config:i}=await e.json(),o=null;if((0,w.existsSync)(k))try{o=JSON.parse((0,w.readFileSync)(k,"utf-8"))}catch{o=null}if("string"==typeof i&&i.trim())try{if(!(t=JSON.parse(i))||"object"!=typeof t)throw Error("Invalid config object")}catch(e){return v.NextResponse.json({error:"Invalid config JSON: "+(e.message||"parse error")},{status:400})}else{if(!a)return v.NextResponse.json({error:"Missing required field: default_model"},{status:400});t=await (0,b.buildMergedConfig)({defaultModel:a,defaultFallbacks:r,imageModel:n||void 0,imageFallbacks:s},o)}let l=function(){try{if((0,w.existsSync)(k)){let e=(0,w.readFileSync)(k,"utf-8"),t=!1;try{let a=JSON.parse(e);t=!!a.models?.providers?.["aar-gateway"]}catch{}return t||(0,w.writeFileSync)(E,e,"utf-8"),{success:!0,existed:!0,isFromAar:t}}return{success:!0,existed:!1,isFromAar:!1}}catch(e){return{success:!1,existed:!1,isFromAar:!1,error:`Backup failed: ${e.message}`}}}();if(!l.success)return v.NextResponse.json({error:l.error},{status:500});(0,w.existsSync)(C)||(0,w.mkdirSync)(C,{recursive:!0});let d=JSON.stringify(t,null,2);(0,w.writeFileSync)(k,d,"utf-8");let u=!!o?.models?.providers?.["aar-gateway"];return v.NextResponse.json({success:!0,message:u?"OpenClaw 配置已更新为最新网关信息":"OpenClaw configuration applied successfully",config:t,backup:l.existed?"Created backup":"No existing config to backup",previousWasFromAar:l.existed&&l.isFromAar})}catch(e){return console.error("OpenClaw Apply API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["POST",0,A],82069);var N=e.i(82069);let S=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/ide/openclaw/apply/route",pathname:"/api/ide/openclaw/apply",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/openclaw/apply/route.ts",nextConfigOutput:"",userland:N}),{workAsyncStorage:j,workUnitAsyncStorage:_,serverHooks:O}=S;async function T(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),S.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/ide/openclaw/apply/route";v=v.replace(/\/index$/,"")||"/";let w=await S.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:y,params:R,nextConfig:b,parsedUrl:C,isDraftMode:k,prerenderManifest:E,routerServerContext:A,isOnDemandRevalidate:N,revalidateOnlyGenerated:j,resolvedPathname:_,clientReferenceManifest:O,serverActionsManifest:T}=w,q=(0,o.normalizeAppPath)(v),P=!!(E.dynamicRoutes[q]||E.routes[_]),M=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,C,!1):t.end("This page could not be found"),null);if(P&&!k){let e=!!E.routes[_],t=E.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(b.adapterPath)return await M();throw new h.NoFallbackError}}let $=null;!P||S.isDev||k||($="/index"===($=_)?"/":$);let F=!0===S.isDev||!P,I=P&&!F;T&&O&&(0,i.setManifestsSingleton)({page:v,clientReferenceManifest:O,serverActionsManifest:T});let H=e.method||"GET",U=(0,s.getTracer)(),D=U.getActiveScopeSpan(),K=!!(null==A?void 0:A.isWrappedByNextServer),W=!!(0,n.getRequestMeta)(e,"minimalMode"),B=(0,n.getRequestMeta)(e,"incrementalCache")||await S.getIncrementalCache(e,b,E,W);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let J={params:R,previewProps:E.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts},cacheComponents:!!b.cacheComponents,supportsDynamicResponse:F,incrementalCache:B,cacheLifeProfiles:b.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>S.onRequestError(e,t,r,n,A)},sharedContext:{buildId:y}},L=new l.NodeNextRequest(e),G=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(L,(0,d.signalFromNodeResponse)(t));try{let n,i=async e=>S.handle(V,J).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let a=U.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route");if(r){let t=`${H} ${r}`;e.setAttributes({"next.route":r,"http.route":r,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",r),n.updateName(t))}else e.updateName(`${H} ${v}`)}),o=async n=>{var s,o;let l=async({previousCacheEntry:a})=>{try{if(!W&&N&&j&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=J.renderOpts.fetchMetrics;let o=J.renderOpts.pendingWaitUntil;o&&r.waitUntil&&(r.waitUntil(o),o=void 0);let l=J.renderOpts.collectedTags;if(!P)return await (0,p.sendResponse)(L,G,s,J.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==J.renderOpts.collectedRevalidate&&!(J.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&J.renderOpts.collectedRevalidate,r=void 0===J.renderOpts.collectedExpire||J.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:J.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await S.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:N})},!1,A),t}},d=await S.handleResponse({req:e,nextConfig:b,cacheKey:$,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:E,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:j,responseGenerator:l,waitUntil:r.waitUntil,isMinimalMode:W});if(!P)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});W||t.setHeader("x-nextjs-cache",N?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),k&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return W&&P||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,g.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(L,G,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&D?await o(D):(n=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${H} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},o),void 0,!K))}catch(t){if(t instanceof h.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:I,isOnDemandRevalidate:N})},!1,A),P)throw t;return await (0,p.sendResponse)(L,G,new Response(null,{status:500})),null}}e.s(["handler",0,T,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:j,workUnitAsyncStorage:_})},"routeModule",0,S,"serverHooks",0,O,"workAsyncStorage",0,j,"workUnitAsyncStorage",0,_],17739)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0dj43ut._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/app/api/ide/openclaw/build-config.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/ide/openclaw/apply/route.ts"],"sourcesContent":["import { getDatabase } from '@/db/database';\nimport { getConfig } from '@/db/queries';\nimport { getAllModels } from '@/db/queries';\n\nexport async function getGatewayAddress(): Promise<string> {\n await getDatabase();\n const portConfig = await getConfig('port');\n const port = portConfig?.value || '1357';\n return `http://localhost:${port}/v1`;\n}\n\nexport async function getGatewayApiKey(): Promise<string> {\n await getDatabase();\n const apiKeyConfig = await getConfig('api_key');\n return apiKeyConfig?.value || 'your-gateway-api-key';\n}\n\n/** OpenClaw provider entry structure */\nexport type OpenClawProviderEntry = {\n baseUrl: string;\n apiKey: string;\n api: 'openai-completions';\n models: Array<{\n id: string;\n name: string;\n reasoning?: boolean;\n input?: string[];\n cost?: {\n input: number;\n output: number;\n cacheRead: number;\n cacheWrite: number;\n };\n contextWindow?: number;\n maxTokens?: number;\n }>;\n};\n\nexport async function buildAarGatewayProvider(): Promise<OpenClawProviderEntry> {\n const gatewayAddress = await getGatewayAddress();\n const gatewayApiKey = await getGatewayApiKey();\n const allModels = (await getAllModels()).filter((m: any) => m.enabled);\n\n const models = allModels.map((m: any) => ({\n id: m.model_id,\n name: m.name,\n reasoning: m.reasoning || false,\n input: m.input || ['text'],\n cost: m.cost || { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n contextWindow: m.context_window || 200000,\n maxTokens: m.max_tokens || 8192,\n }));\n\n return {\n baseUrl: gatewayAddress,\n apiKey: gatewayApiKey,\n api: 'openai-completions',\n models,\n };\n}\n\nconst AAR_PROVIDER_ID = 'aar-gateway';\n\n/** Merge existing OpenClaw config with AAR gateway */\nexport function mergeConfigWithAar(\n existing: Record<string, any> | null,\n config: {\n defaultModel: string;\n defaultFallbacks?: string[];\n imageModel?: string;\n imageFallbacks?: string[];\n },\n aarProvider: OpenClawProviderEntry\n): Record<string, any> {\n const base = existing && typeof existing === 'object' ? { ...existing } : {};\n\n // Update models.providers\n const modelsConfig = base.models || {};\n const providers = modelsConfig.providers || {};\n providers[AAR_PROVIDER_ID] = aarProvider;\n modelsConfig.providers = providers;\n modelsConfig.mode = 'merge';\n base.models = modelsConfig;\n\n // Update agents.defaults.model\n const agents = base.agents || {};\n const defaults = agents.defaults || {};\n const model = defaults.model || {};\n\n // Format: provider/model\n const fullModelId = `${AAR_PROVIDER_ID}/${config.defaultModel}`;\n const fullImageModelId = config.imageModel\n ? `${AAR_PROVIDER_ID}/${config.imageModel}`\n : undefined;\n\n model.primary = fullModelId;\n if (config.defaultFallbacks && config.defaultFallbacks.length > 0) {\n model.fallbacks = config.defaultFallbacks.map((m: string) =>\n m.startsWith(`${AAR_PROVIDER_ID}/`) ? m : `${AAR_PROVIDER_ID}/${m}`\n );\n } else {\n delete model.fallbacks;\n }\n\n defaults.model = model;\n\n // Update agents.defaults.imageModel\n const imageModel = defaults.imageModel || {};\n if (fullImageModelId) {\n imageModel.primary = fullImageModelId;\n }\n if (config.imageFallbacks && config.imageFallbacks.length > 0) {\n imageModel.fallbacks = config.imageFallbacks.map((m: string) =>\n m.startsWith(`${AAR_PROVIDER_ID}/`) ? m : `${AAR_PROVIDER_ID}/${m}`\n );\n } else {\n delete imageModel.fallbacks;\n }\n defaults.imageModel = imageModel;\n\n // Update agents.defaults.models so OpenClaw can resolve aar-gateway model ids (alias, etc.)\n const modelsMap = defaults.models || {};\n for (const m of aarProvider.models) {\n const fullId = `${AAR_PROVIDER_ID}/${m.id}`;\n modelsMap[fullId] = modelsMap[fullId] || { alias: m.name };\n }\n defaults.models = modelsMap;\n\n agents.defaults = defaults;\n base.agents = agents;\n\n // Ensure channels exists (even if empty)\n if (!base.channels) {\n base.channels = {};\n }\n\n return base;\n}\n\n/** Generate merged config for preview or apply */\nexport async function buildMergedConfig(\n config: {\n defaultModel: string;\n defaultFallbacks?: string[];\n imageModel?: string;\n imageFallbacks?: string[];\n },\n existing: Record<string, any> | null\n): Promise<Record<string, any>> {\n const aarProvider = await buildAarGatewayProvider();\n return mergeConfigWithAar(existing, config, aarProvider);\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/ide/openclaw/apply/route\",\n pathname: \"/api/ide/openclaw/apply\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/ide/openclaw/apply/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/ide/openclaw/apply/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextRequest, NextResponse } from 'next/server';\nimport { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { buildMergedConfig } from '../build-config';\n\nconst OPENCLAW_DIR = join(homedir(), '.openclaw');\nconst OPENCLAW_FILE = join(OPENCLAW_DIR, 'openclaw.json');\nconst BACKUP_FILE = join(OPENCLAW_DIR, 'openclaw.json.aar.bak');\n\nfunction backupOriginalConfig(): { success: boolean; existed: boolean; isFromAar: boolean; error?: string } {\n try {\n const existing = existsSync(OPENCLAW_FILE);\n if (existing) {\n const original = readFileSync(OPENCLAW_FILE, 'utf-8');\n let isFromAar = false;\n try {\n const parsed = JSON.parse(original);\n isFromAar = !!(parsed.models?.providers?.['aar-gateway']);\n } catch {}\n // 仅在当前配置不是 AAR 时写入备份,这样「还原」才能恢复到应用 AAR 前的状态;若已是 AAR 则保留原有备份不覆盖\n if (!isFromAar) {\n writeFileSync(BACKUP_FILE, original, 'utf-8');\n }\n return { success: true, existed: true, isFromAar };\n }\n return { success: true, existed: false, isFromAar: false };\n } catch (error: any) {\n return { success: false, existed: false, isFromAar: false, error: `Backup failed: ${error.message}` };\n }\n}\n\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json();\n const {\n default_model: defaultModel,\n default_fallbacks: defaultFallbacks = [],\n image_model: imageModel,\n image_fallbacks: imageFallbacks = [],\n config: customConfigStr,\n } = body;\n\n let existing: Record<string, any> | null = null;\n if (existsSync(OPENCLAW_FILE)) {\n try {\n existing = JSON.parse(readFileSync(OPENCLAW_FILE, 'utf-8'));\n } catch {\n existing = null;\n }\n }\n\n let config: Record<string, any>;\n if (typeof customConfigStr === 'string' && customConfigStr.trim()) {\n try {\n config = JSON.parse(customConfigStr);\n if (!config || typeof config !== 'object') throw new Error('Invalid config object');\n } catch (e: any) {\n return NextResponse.json({ error: 'Invalid config JSON: ' + (e.message || 'parse error') }, { status: 400 });\n }\n } else {\n if (!defaultModel) {\n return NextResponse.json({ error: 'Missing required field: default_model' }, { status: 400 });\n }\n config = await buildMergedConfig(\n {\n defaultModel,\n defaultFallbacks,\n imageModel: imageModel || undefined,\n imageFallbacks,\n },\n existing\n );\n }\n\n const backupResult = backupOriginalConfig();\n if (!backupResult.success) {\n return NextResponse.json({ error: backupResult.error }, { status: 500 });\n }\n\n if (!existsSync(OPENCLAW_DIR)) {\n mkdirSync(OPENCLAW_DIR, { recursive: true });\n }\n\n const jsonString = JSON.stringify(config, null, 2);\n writeFileSync(OPENCLAW_FILE, jsonString, 'utf-8');\n\n const alreadyHadAar = !!(existing?.models?.providers?.['aar-gateway']);\n return NextResponse.json({\n success: true,\n message: alreadyHadAar ? 'OpenClaw 配置已更新为最新网关信息' : 'OpenClaw configuration applied successfully',\n config,\n backup: backupResult.existed ? 'Created backup' : 'No existing config to backup',\n previousWasFromAar: backupResult.existed && backupResult.isFromAar,\n });\n } catch (error: any) {\n console.error('OpenClaw Apply API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n"],"names":["getGatewayAddress","portConfig","port","value","getGatewayApiKey","apiKeyConfig","buildAarGatewayProvider","gatewayAddress","gatewayApiKey","allModels","filter","m","enabled","models","map","id","model_id","name","reasoning","input","cost","output","cacheRead","cacheWrite","contextWindow","context_window","maxTokens","max_tokens","baseUrl","apiKey","api","AAR_PROVIDER_ID","mergeConfigWithAar","existing","config","aarProvider","base","modelsConfig","providers","mode","agents","defaults","model","fullModelId","defaultModel","fullImageModelId","imageModel","undefined","primary","defaultFallbacks","length","fallbacks","startsWith","imageFallbacks","modelsMap","fullId","alias","channels","buildMergedConfig","OPENCLAW_DIR","OPENCLAW_FILE","BACKUP_FILE","backupOriginalConfig","original","isFromAar","parsed","JSON","parse","success","existed","error","message","POST","request","body","json","default_model","default_fallbacks","image_model","image_fallbacks","customConfigStr","status","trim","Error","e","backupResult","recursive","jsonString","stringify","alreadyHadAar","backup","previousWasFromAar","console","stack"],"mappings":"8iCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAGO,eAAeA,IACpB,MAAM,CAAA,EAAA,EAAA,WAAA,AAAW,IACjB,IAAMC,EAAa,MAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,QAC7BC,EAAOD,GAAYE,OAAS,OAClC,MAAO,CAAC,iBAAiB,EAAED,EAAK,GAAG,CAAC,AACtC,CAEO,eAAeE,IACpB,MAAM,CAAA,EAAA,EAAA,WAAA,AAAW,IACjB,IAAMC,EAAe,MAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,WACrC,OAAOA,GAAcF,OAAS,sBACh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