ai-agent-router 0.2.0 → 0.2.2

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 (354) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +14 -0
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/fallback-build-manifest.json +2 -2
  5. package/.next/next-server.js.nft.json +1 -1
  6. package/.next/prerender-manifest.json +3 -3
  7. package/.next/required-server-files.js +4 -4
  8. package/.next/required-server-files.json +4 -4
  9. package/.next/routes-manifest.json +84 -0
  10. package/.next/server/app/_global-error/page.js +1 -1
  11. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  12. package/.next/server/app/_global-error.html +2 -2
  13. package/.next/server/app/_global-error.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  19. package/.next/server/app/_not-found/page.js +2 -2
  20. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  21. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/_not-found.html +1 -1
  23. package/.next/server/app/_not-found.rsc +2 -2
  24. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  25. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  26. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  27. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  28. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  29. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  30. package/.next/server/app/api/config/route.js.nft.json +1 -1
  31. package/.next/server/app/api/gateway/[...path]/route.js.nft.json +1 -1
  32. package/.next/server/app/api/gateway/models/route.js.nft.json +1 -1
  33. package/.next/server/app/api/gateway/route.js.nft.json +1 -1
  34. package/.next/server/app/api/ide/claude/apply/route.js.nft.json +1 -1
  35. package/.next/server/app/api/ide/claude/available-models/route.js.nft.json +1 -1
  36. package/.next/server/app/api/ide/claude/restore/route.js.nft.json +1 -1
  37. package/.next/server/app/api/ide/claude/save/route.js.nft.json +1 -1
  38. package/.next/server/app/api/ide/claude/status/route.js.nft.json +1 -1
  39. package/.next/server/app/api/ide/claude/test/route.js +1 -1
  40. package/.next/server/app/api/ide/claude/test/route.js.nft.json +1 -1
  41. package/.next/server/app/api/ide/openclaw/apply/route/app-paths-manifest.json +3 -0
  42. package/.next/server/app/api/ide/openclaw/apply/route/build-manifest.json +11 -0
  43. package/.next/server/app/api/ide/openclaw/apply/route/server-reference-manifest.json +4 -0
  44. package/.next/server/app/api/ide/openclaw/apply/route.js +7 -0
  45. package/.next/server/app/api/ide/openclaw/apply/route.js.map +5 -0
  46. package/.next/server/app/api/ide/openclaw/apply/route.js.nft.json +1 -0
  47. package/.next/server/app/api/ide/openclaw/apply/route_client-reference-manifest.js +2 -0
  48. package/.next/server/app/api/ide/openclaw/available-models/route/app-paths-manifest.json +3 -0
  49. package/.next/server/app/api/ide/openclaw/available-models/route/build-manifest.json +11 -0
  50. package/.next/server/app/api/ide/openclaw/available-models/route/server-reference-manifest.json +4 -0
  51. package/.next/server/app/api/ide/openclaw/available-models/route.js +7 -0
  52. package/.next/server/app/api/ide/openclaw/available-models/route.js.map +5 -0
  53. package/.next/server/app/api/ide/openclaw/available-models/route.js.nft.json +1 -0
  54. package/.next/server/app/api/ide/openclaw/available-models/route_client-reference-manifest.js +2 -0
  55. package/.next/server/app/api/ide/openclaw/preview/route/app-paths-manifest.json +3 -0
  56. package/.next/server/app/api/ide/openclaw/preview/route/build-manifest.json +11 -0
  57. package/.next/server/app/api/ide/openclaw/preview/route/server-reference-manifest.json +4 -0
  58. package/.next/server/app/api/ide/openclaw/preview/route.js +7 -0
  59. package/.next/server/app/api/ide/openclaw/preview/route.js.map +5 -0
  60. package/.next/server/app/api/ide/openclaw/preview/route.js.nft.json +1 -0
  61. package/.next/server/app/api/ide/openclaw/preview/route_client-reference-manifest.js +2 -0
  62. package/.next/server/app/api/ide/openclaw/restore/route/app-paths-manifest.json +3 -0
  63. package/.next/server/app/api/ide/openclaw/restore/route/build-manifest.json +11 -0
  64. package/.next/server/app/api/ide/openclaw/restore/route/server-reference-manifest.json +4 -0
  65. package/.next/server/app/api/ide/openclaw/restore/route.js +6 -0
  66. package/.next/server/app/api/ide/openclaw/restore/route.js.map +5 -0
  67. package/.next/server/app/api/ide/openclaw/restore/route.js.nft.json +1 -0
  68. package/.next/server/app/api/ide/openclaw/restore/route_client-reference-manifest.js +2 -0
  69. package/.next/server/app/api/ide/openclaw/save/route/app-paths-manifest.json +3 -0
  70. package/.next/server/app/api/ide/openclaw/save/route/build-manifest.json +11 -0
  71. package/.next/server/app/api/ide/openclaw/save/route/server-reference-manifest.json +4 -0
  72. package/.next/server/app/api/ide/openclaw/save/route.js +7 -0
  73. package/.next/server/app/api/ide/openclaw/save/route.js.map +5 -0
  74. package/.next/server/app/api/ide/openclaw/save/route.js.nft.json +1 -0
  75. package/.next/server/app/api/ide/openclaw/save/route_client-reference-manifest.js +2 -0
  76. package/.next/server/app/api/ide/openclaw/status/route/app-paths-manifest.json +3 -0
  77. package/.next/server/app/api/ide/openclaw/status/route/build-manifest.json +11 -0
  78. package/.next/server/app/api/ide/openclaw/status/route/server-reference-manifest.json +4 -0
  79. package/.next/server/app/api/ide/openclaw/status/route.js +7 -0
  80. package/.next/server/app/api/ide/openclaw/status/route.js.map +5 -0
  81. package/.next/server/app/api/ide/openclaw/status/route.js.nft.json +1 -0
  82. package/.next/server/app/api/ide/openclaw/status/route_client-reference-manifest.js +2 -0
  83. package/.next/server/app/api/ide/openclaw/test/route/app-paths-manifest.json +3 -0
  84. package/.next/server/app/api/ide/openclaw/test/route/build-manifest.json +11 -0
  85. package/.next/server/app/api/ide/openclaw/test/route/server-reference-manifest.json +4 -0
  86. package/.next/server/app/api/ide/openclaw/test/route.js +6 -0
  87. package/.next/server/app/api/ide/openclaw/test/route.js.map +5 -0
  88. package/.next/server/app/api/ide/openclaw/test/route.js.nft.json +1 -0
  89. package/.next/server/app/api/ide/openclaw/test/route_client-reference-manifest.js +2 -0
  90. package/.next/server/app/api/ide/opencode/apply/route/app-paths-manifest.json +3 -0
  91. package/.next/server/app/api/ide/opencode/apply/route/build-manifest.json +11 -0
  92. package/.next/server/app/api/ide/opencode/apply/route/server-reference-manifest.json +4 -0
  93. package/.next/server/app/api/ide/opencode/apply/route.js +7 -0
  94. package/.next/server/app/api/ide/opencode/apply/route.js.map +5 -0
  95. package/.next/server/app/api/ide/opencode/apply/route.js.nft.json +1 -0
  96. package/.next/server/app/api/ide/opencode/apply/route_client-reference-manifest.js +2 -0
  97. package/.next/server/app/api/ide/opencode/available-models/route/app-paths-manifest.json +3 -0
  98. package/.next/server/app/api/ide/opencode/available-models/route/build-manifest.json +11 -0
  99. package/.next/server/app/api/ide/opencode/available-models/route/server-reference-manifest.json +4 -0
  100. package/.next/server/app/api/ide/opencode/available-models/route.js +7 -0
  101. package/.next/server/app/api/ide/opencode/available-models/route.js.map +5 -0
  102. package/.next/server/app/api/ide/opencode/available-models/route.js.nft.json +1 -0
  103. package/.next/server/app/api/ide/opencode/available-models/route_client-reference-manifest.js +2 -0
  104. package/.next/server/app/api/ide/opencode/preview/route/app-paths-manifest.json +3 -0
  105. package/.next/server/app/api/ide/opencode/preview/route/build-manifest.json +11 -0
  106. package/.next/server/app/api/ide/opencode/preview/route/server-reference-manifest.json +4 -0
  107. package/.next/server/app/api/ide/opencode/preview/route.js +7 -0
  108. package/.next/server/app/api/ide/opencode/preview/route.js.map +5 -0
  109. package/.next/server/app/api/ide/opencode/preview/route.js.nft.json +1 -0
  110. package/.next/server/app/api/ide/opencode/preview/route_client-reference-manifest.js +2 -0
  111. package/.next/server/app/api/ide/opencode/restore/route/app-paths-manifest.json +3 -0
  112. package/.next/server/app/api/ide/opencode/restore/route/build-manifest.json +11 -0
  113. package/.next/server/app/api/ide/opencode/restore/route/server-reference-manifest.json +4 -0
  114. package/.next/server/app/api/ide/opencode/restore/route.js +6 -0
  115. package/.next/server/app/api/ide/opencode/restore/route.js.map +5 -0
  116. package/.next/server/app/api/ide/opencode/restore/route.js.nft.json +1 -0
  117. package/.next/server/app/api/ide/opencode/restore/route_client-reference-manifest.js +2 -0
  118. package/.next/server/app/api/ide/opencode/save/route/app-paths-manifest.json +3 -0
  119. package/.next/server/app/api/ide/opencode/save/route/build-manifest.json +11 -0
  120. package/.next/server/app/api/ide/opencode/save/route/server-reference-manifest.json +4 -0
  121. package/.next/server/app/api/ide/opencode/save/route.js +7 -0
  122. package/.next/server/app/api/ide/opencode/save/route.js.map +5 -0
  123. package/.next/server/app/api/ide/opencode/save/route.js.nft.json +1 -0
  124. package/.next/server/app/api/ide/opencode/save/route_client-reference-manifest.js +2 -0
  125. package/.next/server/app/api/ide/opencode/status/route/app-paths-manifest.json +3 -0
  126. package/.next/server/app/api/ide/opencode/status/route/build-manifest.json +11 -0
  127. package/.next/server/app/api/ide/opencode/status/route/server-reference-manifest.json +4 -0
  128. package/.next/server/app/api/ide/opencode/status/route.js +7 -0
  129. package/.next/server/app/api/ide/opencode/status/route.js.map +5 -0
  130. package/.next/server/app/api/ide/opencode/status/route.js.nft.json +1 -0
  131. package/.next/server/app/api/ide/opencode/status/route_client-reference-manifest.js +2 -0
  132. package/.next/server/app/api/ide/opencode/test/route/app-paths-manifest.json +3 -0
  133. package/.next/server/app/api/ide/opencode/test/route/build-manifest.json +11 -0
  134. package/.next/server/app/api/ide/opencode/test/route/server-reference-manifest.json +4 -0
  135. package/.next/server/app/api/ide/opencode/test/route.js +6 -0
  136. package/.next/server/app/api/ide/opencode/test/route.js.map +5 -0
  137. package/.next/server/app/api/ide/opencode/test/route.js.nft.json +1 -0
  138. package/.next/server/app/api/ide/opencode/test/route_client-reference-manifest.js +2 -0
  139. package/.next/server/app/api/logs/route.js.nft.json +1 -1
  140. package/.next/server/app/api/models/route.js.nft.json +1 -1
  141. package/.next/server/app/api/providers/route.js.nft.json +1 -1
  142. package/.next/server/app/api/providers/test/route.js.nft.json +1 -1
  143. package/.next/server/app/api/service/force-stop/route.js.nft.json +1 -1
  144. package/.next/server/app/api/service/start/route.js.nft.json +1 -1
  145. package/.next/server/app/api/service/status/route.js.nft.json +1 -1
  146. package/.next/server/app/api/service/stop/route.js.nft.json +1 -1
  147. package/.next/server/app/ide/page.js +2 -2
  148. package/.next/server/app/ide/page.js.nft.json +1 -1
  149. package/.next/server/app/ide/page_client-reference-manifest.js +1 -1
  150. package/.next/server/app/ide.html +1 -1
  151. package/.next/server/app/ide.rsc +3 -3
  152. package/.next/server/app/ide.segments/_full.segment.rsc +3 -3
  153. package/.next/server/app/ide.segments/_head.segment.rsc +1 -1
  154. package/.next/server/app/ide.segments/_index.segment.rsc +2 -2
  155. package/.next/server/app/ide.segments/_tree.segment.rsc +2 -2
  156. package/.next/server/app/ide.segments/ide/__PAGE__.segment.rsc +2 -2
  157. package/.next/server/app/ide.segments/ide.segment.rsc +1 -1
  158. package/.next/server/app/index.html +1 -1
  159. package/.next/server/app/index.rsc +2 -2
  160. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  161. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  162. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  163. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  164. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  165. package/.next/server/app/logs/page.js +2 -2
  166. package/.next/server/app/logs/page.js.nft.json +1 -1
  167. package/.next/server/app/logs/page_client-reference-manifest.js +1 -1
  168. package/.next/server/app/logs.html +1 -1
  169. package/.next/server/app/logs.rsc +3 -3
  170. package/.next/server/app/logs.segments/_full.segment.rsc +3 -3
  171. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  172. package/.next/server/app/logs.segments/_index.segment.rsc +2 -2
  173. package/.next/server/app/logs.segments/_tree.segment.rsc +2 -2
  174. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +2 -2
  175. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  176. package/.next/server/app/models/page.js +2 -2
  177. package/.next/server/app/models/page.js.nft.json +1 -1
  178. package/.next/server/app/models/page_client-reference-manifest.js +1 -1
  179. package/.next/server/app/models.html +1 -1
  180. package/.next/server/app/models.rsc +2 -2
  181. package/.next/server/app/models.segments/_full.segment.rsc +2 -2
  182. package/.next/server/app/models.segments/_head.segment.rsc +1 -1
  183. package/.next/server/app/models.segments/_index.segment.rsc +2 -2
  184. package/.next/server/app/models.segments/_tree.segment.rsc +2 -2
  185. package/.next/server/app/models.segments/models/__PAGE__.segment.rsc +1 -1
  186. package/.next/server/app/models.segments/models.segment.rsc +1 -1
  187. package/.next/server/app/page.js +2 -2
  188. package/.next/server/app/page.js.nft.json +1 -1
  189. package/.next/server/app/page_client-reference-manifest.js +1 -1
  190. package/.next/server/app/providers/page.js +2 -2
  191. package/.next/server/app/providers/page.js.nft.json +1 -1
  192. package/.next/server/app/providers/page_client-reference-manifest.js +1 -1
  193. package/.next/server/app/providers.html +1 -1
  194. package/.next/server/app/providers.rsc +2 -2
  195. package/.next/server/app/providers.segments/_full.segment.rsc +2 -2
  196. package/.next/server/app/providers.segments/_head.segment.rsc +1 -1
  197. package/.next/server/app/providers.segments/_index.segment.rsc +2 -2
  198. package/.next/server/app/providers.segments/_tree.segment.rsc +2 -2
  199. package/.next/server/app/providers.segments/providers/__PAGE__.segment.rsc +1 -1
  200. package/.next/server/app/providers.segments/providers.segment.rsc +1 -1
  201. package/.next/server/app-paths-manifest.json +14 -0
  202. package/.next/server/chunks/[root-of-the-server]__001d5756._.js +3 -0
  203. package/.next/server/chunks/[root-of-the-server]__001d5756._.js.map +1 -0
  204. package/.next/server/chunks/[root-of-the-server]__05f8578b._.js +3 -0
  205. package/.next/server/chunks/[root-of-the-server]__05f8578b._.js.map +1 -0
  206. package/.next/server/chunks/[root-of-the-server]__3a204d25._.js +1 -1
  207. package/.next/server/chunks/[root-of-the-server]__3a204d25._.js.map +1 -1
  208. package/.next/server/chunks/[root-of-the-server]__43810962._.js +3 -0
  209. package/.next/server/chunks/[root-of-the-server]__43810962._.js.map +1 -0
  210. package/.next/server/chunks/[root-of-the-server]__4a8f9bc7._.js +1 -1
  211. package/.next/server/chunks/[root-of-the-server]__4a8f9bc7._.js.map +1 -1
  212. package/.next/server/chunks/[root-of-the-server]__55cd88b8._.js +3 -0
  213. package/.next/server/chunks/[root-of-the-server]__55cd88b8._.js.map +1 -0
  214. package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js +1 -1
  215. package/.next/server/chunks/[root-of-the-server]__5e8276bc._.js.map +1 -1
  216. package/.next/server/chunks/[root-of-the-server]__760eaa16._.js +3 -0
  217. package/.next/server/chunks/[root-of-the-server]__760eaa16._.js.map +1 -0
  218. package/.next/server/chunks/[root-of-the-server]__7c298a19._.js +3 -0
  219. package/.next/server/chunks/[root-of-the-server]__7c298a19._.js.map +1 -0
  220. package/.next/server/chunks/[root-of-the-server]__85540228._.js +3 -0
  221. package/.next/server/chunks/[root-of-the-server]__85540228._.js.map +1 -0
  222. package/.next/server/chunks/[root-of-the-server]__94fe8d3c._.js +3 -0
  223. package/.next/server/chunks/[root-of-the-server]__94fe8d3c._.js.map +1 -0
  224. package/.next/server/chunks/[root-of-the-server]__97622908._.js +3 -0
  225. package/.next/server/chunks/[root-of-the-server]__97622908._.js.map +1 -0
  226. package/.next/server/chunks/[root-of-the-server]__a02e6618._.js +3 -0
  227. package/.next/server/chunks/[root-of-the-server]__a02e6618._.js.map +1 -0
  228. package/.next/server/chunks/[root-of-the-server]__a32a20a7._.js +3 -0
  229. package/.next/server/chunks/[root-of-the-server]__a32a20a7._.js.map +1 -0
  230. package/.next/server/chunks/[root-of-the-server]__af5b556a._.js +3 -0
  231. package/.next/server/chunks/[root-of-the-server]__af5b556a._.js.map +1 -0
  232. package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js +16 -16
  233. package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js.map +1 -1
  234. package/.next/server/chunks/[root-of-the-server]__cafe113e._.js +3 -0
  235. package/.next/server/chunks/[root-of-the-server]__cafe113e._.js.map +1 -0
  236. package/.next/server/chunks/[root-of-the-server]__dc8b0bed._.js +3 -0
  237. package/.next/server/chunks/[root-of-the-server]__dc8b0bed._.js.map +1 -0
  238. package/.next/server/chunks/[root-of-the-server]__f0461b8d._.js +1 -1
  239. package/.next/server/chunks/[root-of-the-server]__f0461b8d._.js.map +1 -1
  240. package/.next/server/chunks/[root-of-the-server]__f8949f88._.js +1 -1
  241. package/.next/server/chunks/[root-of-the-server]__f8949f88._.js.map +1 -1
  242. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_apply_route_actions_2cb9e4b4.js +3 -0
  243. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_apply_route_actions_2cb9e4b4.js.map +1 -0
  244. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_preview_route_actions_9814a8e4.js +3 -0
  245. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_preview_route_actions_9814a8e4.js.map +1 -0
  246. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_restore_route_actions_10ad8f9d.js +3 -0
  247. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_restore_route_actions_10ad8f9d.js.map +1 -0
  248. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_save_route_actions_044ad081.js +3 -0
  249. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_save_route_actions_044ad081.js.map +1 -0
  250. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_status_route_actions_ed9786d2.js +3 -0
  251. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_status_route_actions_ed9786d2.js.map +1 -0
  252. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_test_route_actions_ce2cb808.js +3 -0
  253. package/.next/server/chunks/_next-internal_server_app_api_ide_openclaw_test_route_actions_ce2cb808.js.map +1 -0
  254. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_apply_route_actions_6c422244.js +3 -0
  255. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_apply_route_actions_6c422244.js.map +1 -0
  256. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_preview_route_actions_256c82e0.js +3 -0
  257. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_preview_route_actions_256c82e0.js.map +1 -0
  258. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_restore_route_actions_371993d3.js +3 -0
  259. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_restore_route_actions_371993d3.js.map +1 -0
  260. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_save_route_actions_6e4c9c41.js +3 -0
  261. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_save_route_actions_6e4c9c41.js.map +1 -0
  262. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_status_route_actions_498ad77b.js +3 -0
  263. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_status_route_actions_498ad77b.js.map +1 -0
  264. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_test_route_actions_c71be510.js +3 -0
  265. package/.next/server/chunks/_next-internal_server_app_api_ide_opencode_test_route_actions_c71be510.js.map +1 -0
  266. package/.next/server/chunks/ce889_server_app_api_ide_openclaw_available-models_route_actions_e568e70b.js +3 -0
  267. package/.next/server/chunks/ce889_server_app_api_ide_openclaw_available-models_route_actions_e568e70b.js.map +1 -0
  268. package/.next/server/chunks/ce889_server_app_api_ide_opencode_available-models_route_actions_95230db3.js +3 -0
  269. package/.next/server/chunks/ce889_server_app_api_ide_opencode_available-models_route_actions_95230db3.js.map +1 -0
  270. package/.next/server/chunks/ssr/{[root-of-the-server]__bec95712._.js → [root-of-the-server]__81937253._.js} +2 -2
  271. package/.next/server/chunks/ssr/{[root-of-the-server]__bec95712._.js.map → [root-of-the-server]__81937253._.js.map} +1 -1
  272. package/.next/server/chunks/ssr/{[root-of-the-server]__71c85955._.js → [root-of-the-server]__976ad963._.js} +2 -2
  273. package/.next/server/chunks/ssr/{[root-of-the-server]__71c85955._.js.map → [root-of-the-server]__976ad963._.js.map} +1 -1
  274. package/.next/server/chunks/ssr/_69468f4c._.js +3 -0
  275. package/.next/server/chunks/ssr/_69468f4c._.js.map +1 -0
  276. package/.next/server/chunks/ssr/src_app_ide_page_tsx_8962793b._.js +1 -1
  277. package/.next/server/chunks/ssr/src_app_ide_page_tsx_8962793b._.js.map +1 -1
  278. package/.next/server/chunks/ssr/src_app_logs_page_tsx_7b7b7b83._.js +1 -1
  279. package/.next/server/chunks/ssr/src_app_logs_page_tsx_7b7b7b83._.js.map +1 -1
  280. package/.next/server/pages/404.html +1 -1
  281. package/.next/server/pages/500.html +2 -2
  282. package/.next/server/server-reference-manifest.js +1 -1
  283. package/.next/server/server-reference-manifest.json +1 -1
  284. package/.next/static/chunks/64f547b3bcd3aef4.js +1 -0
  285. package/.next/static/chunks/6992685fe009e8fd.css +1 -0
  286. package/.next/static/chunks/{b6b258e8582e47c4.js → 7c8b7cbb3339f139.js} +1 -1
  287. package/.next/static/chunks/8ccc14e022ff6de3.js +1 -0
  288. package/.next/types/routes.d.ts +15 -1
  289. package/.next/types/validator.ts +126 -0
  290. package/README.md +31 -4
  291. package/dist/.next/dev/types/validator.js +56 -0
  292. package/dist/.next/types/validator.js +56 -0
  293. package/dist/package.json +55 -0
  294. package/dist/src/app/api/config/route.js +17 -0
  295. package/dist/src/app/api/ide/claude/apply/route.js +126 -31
  296. package/dist/src/app/api/ide/claude/restore/route.js +30 -0
  297. package/dist/src/app/api/ide/claude/save/route.js +79 -0
  298. package/dist/src/app/api/ide/claude/status/route.js +6 -1
  299. package/dist/src/app/api/ide/openclaw/apply/route.js +92 -0
  300. package/dist/src/app/api/ide/openclaw/available-models/route.js +46 -0
  301. package/dist/src/app/api/ide/openclaw/build-config.js +101 -0
  302. package/dist/src/app/api/ide/openclaw/preview/route.js +49 -0
  303. package/dist/src/app/api/ide/openclaw/restore/route.js +24 -0
  304. package/dist/src/app/api/ide/openclaw/save/route.js +54 -0
  305. package/dist/src/app/api/ide/openclaw/status/route.js +139 -0
  306. package/dist/src/app/api/ide/openclaw/test/route.js +158 -0
  307. package/dist/src/app/api/ide/opencode/apply/route.js +89 -0
  308. package/dist/src/app/api/ide/opencode/available-models/route.js +46 -0
  309. package/dist/src/app/api/ide/opencode/build-config.js +54 -0
  310. package/dist/src/app/api/ide/opencode/preview/route.js +36 -0
  311. package/dist/src/app/api/ide/opencode/restore/route.js +40 -0
  312. package/dist/src/app/api/ide/opencode/save/route.js +123 -0
  313. package/dist/src/app/api/ide/opencode/status/route.js +106 -0
  314. package/dist/src/app/api/ide/opencode/test/route.js +136 -0
  315. package/dist/src/app/components/Footer.js +11 -0
  316. package/dist/src/app/ide/page.js +651 -81
  317. package/dist/src/app/layout.js +5 -1
  318. package/dist/src/app/logs/page.js +4 -2
  319. package/dist/src/db/database.js +44 -8
  320. package/package.json +1 -1
  321. package/src/app/api/config/route.ts +17 -0
  322. package/src/app/api/ide/claude/apply/route.ts +140 -31
  323. package/src/app/api/ide/claude/restore/route.ts +36 -1
  324. package/src/app/api/ide/claude/save/route.ts +91 -1
  325. package/src/app/api/ide/claude/status/route.ts +12 -2
  326. package/src/app/api/ide/openclaw/apply/route.ts +103 -0
  327. package/src/app/api/ide/openclaw/available-models/route.ts +59 -0
  328. package/src/app/api/ide/openclaw/build-config.ts +152 -0
  329. package/src/app/api/ide/openclaw/preview/route.ts +57 -0
  330. package/src/app/api/ide/openclaw/restore/route.ts +27 -0
  331. package/src/app/api/ide/openclaw/save/route.ts +67 -0
  332. package/src/app/api/ide/openclaw/status/route.ts +178 -0
  333. package/src/app/api/ide/openclaw/test/route.ts +194 -0
  334. package/src/app/api/ide/opencode/apply/route.ts +92 -0
  335. package/src/app/api/ide/opencode/available-models/route.ts +59 -0
  336. package/src/app/api/ide/opencode/build-config.ts +69 -0
  337. package/src/app/api/ide/opencode/preview/route.ts +40 -0
  338. package/src/app/api/ide/opencode/restore/route.ts +52 -0
  339. package/src/app/api/ide/opencode/save/route.ts +131 -0
  340. package/src/app/api/ide/opencode/status/route.ts +128 -0
  341. package/src/app/api/ide/opencode/test/route.ts +145 -0
  342. package/src/app/components/Footer.tsx +9 -0
  343. package/src/app/globals.css +17 -0
  344. package/src/app/ide/page.tsx +1587 -118
  345. package/src/app/layout.tsx +3 -1
  346. package/src/app/logs/page.tsx +4 -2
  347. package/src/db/database.ts +55 -8
  348. package/.next/server/chunks/ssr/src_app_b2b1d928._.js +0 -3
  349. package/.next/server/chunks/ssr/src_app_b2b1d928._.js.map +0 -1
  350. package/.next/static/chunks/6418ca50028376b7.css +0 -1
  351. package/.next/static/chunks/9ec3b97741b6575e.js +0 -1
  352. /package/.next/static/{ryTeHAYUvjT1bYolc-x9Z → cf2SWIkI5HVbnDjLExI42}/_buildManifest.js +0 -0
  353. /package/.next/static/{ryTeHAYUvjT1bYolc-x9Z → cf2SWIkI5HVbnDjLExI42}/_clientMiddlewareManifest.json +0 -0
  354. /package/.next/static/{ryTeHAYUvjT1bYolc-x9Z → cf2SWIkI5HVbnDjLExI42}/_ssgManifest.js +0 -0
@@ -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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},66926,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=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),c=e.i(47587),p=e.i(66012),x=e.i(70101),h=e.i(26937),g=e.i(10372),R=e.i(93695);e.i(52474);var f=e.i(220),m=e.i(89171),v=e.i(22734),w=e.i(14747),y=e.i(46786),E=e.i(33405);let C=(0,w.join)((0,y.homedir)(),".config","opencode","opencode.json");async function N(e){try{let e;if(!(0,v.existsSync)(C))return m.NextResponse.json({success:!1,error:"Configuration file not found",suggestion:"Please apply configuration first",gatewayRunning:!1});let t=(0,v.readFileSync)(C,"utf-8");try{e=JSON.parse(t)}catch{return m.NextResponse.json({success:!1,error:"Invalid configuration format",gatewayRunning:!1})}let r=e.model;if(!r||"string"!=typeof r)return m.NextResponse.json({success:!1,error:"No model set in config (config.model)",suggestion:"Apply configuration with a default model",gatewayRunning:!1});let n=await new Promise(e=>{let t,n=Date.now(),a=!1,o=(r,o)=>{a||(a=!0,clearTimeout(t),e({success:r,stdout:i,stderr:l,error:o,latency:Date.now()-n}))},s=(0,E.spawn)("opencode",["run",'严格只输出这个 JSON,不要多任何字:{"test":"ok"}',"--model",r],{shell:"win32"===process.platform,stdio:["ignore","pipe","pipe"]}),i="",l="";s.stdout?.on("data",e=>{i+=e.toString("utf-8")}),s.stderr?.on("data",e=>{l+=e.toString("utf-8")}),s.on("error",e=>{o(!1,e.message||"Failed to spawn opencode")}),s.on("close",(e,t)=>{a||((i+l).includes('{"test":"ok"}')?o(!0):0!==e&&null!==e?o(!1,`opencode exited with code ${e}${t?` signal ${t}`:""}`):o(!1,"Output did not contain expected JSON"))}),t=setTimeout(()=>{try{s.kill("SIGTERM")}catch{try{s.kill("SIGKILL")}catch{}}o(!1,"Request timed out")},9e4)});return m.NextResponse.json({success:n.success,gatewayRunning:void 0,opencodeTest:{success:n.success,message:n.success?"opencode run 输出符合预期":n.error||"Output did not contain expected JSON",error:n.error||"",latency:n.latency,stdout:n.stdout.slice(-2e3),stderr:n.stderr.slice(-1e3)},configSummary:{model:r}})}catch(e){return console.error("OpenCode Test API error:",e),m.NextResponse.json({error:e.message||"Internal server error",gatewayRunning:!1},{status:500})}}e.s(["GET",()=>N],47272);var A=e.i(47272);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/opencode/test/route",pathname:"/api/ide/opencode/test",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/opencode/test/route.ts",nextConfigOutput:"",userland:A}),{workAsyncStorage:T,workUnitAsyncStorage:O,serverHooks:b}=S;function P(){return(0,n.patchFetch)({workAsyncStorage:T,workUnitAsyncStorage:O})}async function k(e,t,n){S.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/ide/opencode/test/route";m=m.replace(/\/index$/,"")||"/";let v=await S.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:w,params:y,nextConfig:E,parsedUrl:C,isDraftMode:N,prerenderManifest:A,routerServerContext:T,isOnDemandRevalidate:O,revalidateOnlyGenerated:b,resolvedPathname:P,clientReferenceManifest:k,serverActionsManifest:j}=v,q=(0,i.normalizeAppPath)(m),_=!!(A.dynamicRoutes[q]||A.routes[P]),I=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(_&&!N){let e=!!A.routes[P],t=A.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await I();throw new R.NoFallbackError}}let H=null;!_||S.isDev||N||(H="/index"===(H=P)?"/":H);let U=!0===S.isDev||!_,D=_&&!U;j&&k&&(0,s.setManifestsSingleton)({page:m,clientReferenceManifest:k,serverActionsManifest:j});let M=e.method||"GET",$=(0,o.getTracer)(),F=$.getActiveScopeSpan(),K={params:y,prerenderManifest:A,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>S.onRequestError(e,t,n,a,T)},sharedContext:{buildId:w}},L=new l.NodeNextRequest(e),G=new l.NodeNextResponse(t),B=d.NextRequestAdapter.fromNodeNextRequest(L,(0,d.signalFromNodeResponse)(t));try{let s=async e=>S.handle(B,K).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 n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${m}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var o,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&O&&b&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await s(a);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=K.renderOpts.collectedTags;if(!_)return await (0,p.sendResponse)(L,G,o,K.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[g.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,n=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await S.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:O})},!1,T),t}},u=await S.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:b,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:i});if(!_)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let R=(0,x.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&_||R.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||R.get("Cache-Control")||R.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(L,G,new Response(u.value.body,{headers:R,status:u.value.status||200})),null};F?await l(F):await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${m}`,kind:o.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof R.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:O})},!1,T),_)throw t;return await (0,p.sendResponse)(L,G,new Response(null,{status:500})),null}}e.s(["handler",()=>k,"patchFetch",()=>P,"routeModule",()=>S,"serverHooks",()=>b,"workAsyncStorage",()=>T,"workUnitAsyncStorage",()=>O],66926)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__cafe113e._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/ide/opencode/test/route.ts"],"sourcesContent":["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 } 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/test/route\",\n pathname: \"/api/ide/opencode/test\",\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/test/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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/ide/opencode/test/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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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 } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { spawn } from 'child_process';\n\nconst OPENCODE_FILE =\n process.platform === 'win32'\n ? join(process.env.APPDATA || homedir(), 'opencode', 'opencode.json')\n : join(homedir(), '.config', 'opencode', 'opencode.json');\n\nconst TEST_PROMPT = '严格只输出这个 JSON,不要多任何字:{\"test\":\"ok\"}';\nconst EXPECTED_JSON = '{\"test\":\"ok\"}';\nconst RUN_TIMEOUT_MS = 90_000;\n\n/**\n * 在子进程中执行 opencode run,不阻塞主进程;若输出中出现 {\"test\":\"ok\"} 则判定通过\n */\nfunction runOpencodeTest(model: string): Promise<{ success: boolean; stdout: string; stderr: string; error?: string; latency: number }> {\n return new Promise((resolve) => {\n const start = Date.now();\n let settled = false;\n let timeoutId: ReturnType<typeof setTimeout>;\n const done = (success: boolean, error?: string) => {\n if (settled) return;\n settled = true;\n clearTimeout(timeoutId);\n resolve({\n success,\n stdout,\n stderr,\n error,\n latency: Date.now() - start,\n });\n };\n\n const args = ['run', TEST_PROMPT, '--model', model];\n const child = spawn('opencode', args, {\n shell: process.platform === 'win32',\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n\n child.stdout?.on('data', (chunk: Buffer) => {\n stdout += chunk.toString('utf-8');\n });\n child.stderr?.on('data', (chunk: Buffer) => {\n stderr += chunk.toString('utf-8');\n });\n\n child.on('error', (err) => {\n done(false, err.message || 'Failed to spawn opencode');\n });\n\n child.on('close', (code, signal) => {\n if (settled) return;\n const combined = stdout + stderr;\n const hasExpected = combined.includes(EXPECTED_JSON);\n if (hasExpected) {\n done(true);\n return;\n }\n if (code !== 0 && code !== null) {\n done(false, `opencode exited with code ${code}${signal ? ` signal ${signal}` : ''}`);\n return;\n }\n done(false, 'Output did not contain expected JSON');\n });\n\n timeoutId = setTimeout(() => {\n try {\n child.kill('SIGTERM');\n } catch {\n try {\n child.kill('SIGKILL');\n } catch {}\n }\n done(false, 'Request timed out');\n }, RUN_TIMEOUT_MS);\n });\n}\n\n/**\n * 测试 OpenCode 配置:用子进程执行 opencode run,检查输出是否包含 {\"test\":\"ok\"}\n */\nexport async function GET(request: NextRequest) {\n try {\n if (!existsSync(OPENCODE_FILE)) {\n return NextResponse.json({\n success: false,\n error: 'Configuration file not found',\n suggestion: 'Please apply configuration first',\n gatewayRunning: false,\n });\n }\n\n const content = readFileSync(OPENCODE_FILE, 'utf-8');\n let config: any;\n try {\n config = JSON.parse(content);\n } catch {\n return NextResponse.json({\n success: false,\n error: 'Invalid configuration format',\n gatewayRunning: false,\n });\n }\n\n const model = config.model;\n if (!model || typeof model !== 'string') {\n return NextResponse.json({\n success: false,\n error: 'No model set in config (config.model)',\n suggestion: 'Apply configuration with a default model',\n gatewayRunning: false,\n });\n }\n\n const result = await runOpencodeTest(model);\n\n return NextResponse.json({\n success: result.success,\n gatewayRunning: undefined,\n opencodeTest: {\n success: result.success,\n message: result.success ? 'opencode run 输出符合预期' : (result.error || 'Output did not contain expected JSON'),\n error: result.error || '',\n latency: result.latency,\n stdout: result.stdout.slice(-2000),\n stderr: result.stderr.slice(-1000),\n },\n configSummary: {\n model,\n },\n });\n } catch (error: any) {\n console.error('OpenCode Test API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', gatewayRunning: false },\n { status: 500 }\n );\n }\n}\n"],"names":[],"mappings":"2nCAAA,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,KChBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEA,IAAM,EAGA,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,AAFT,EAES,OAAA,AAAO,IAAI,UAAW,WAAY,IADvC,aA+EC,eAAe,EAAI,CAAoB,EAC5C,GAAI,KAWE,EAVJ,GAAI,CAAC,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,GACd,OAAO,EAAA,IADuB,QACX,CAAC,IAAI,CAAC,CACvB,SAAS,EACT,MAAO,+BACP,WAAY,mCACZ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A,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,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,EAEA,qCAAqC","ignoreList":[0]}
@@ -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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},51523,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),s=e.i(59756),n=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),g=e.i(26937),x=e.i(10372),f=e.i(93695);e.i(52474);var y=e.i(220),m=e.i(89171),v=e.i(22734),R=e.i(14747),w=e.i(46786),C=e.i(33405);let E=(0,R.join)((0,w.homedir)(),".openclaw"),A=(0,R.join)(E,"openclaw.json");async function b(e){try{var t,r;let e;if(!(0,v.existsSync)(A))return m.NextResponse.json({success:!1,error:"Configuration file not found",suggestion:"Please apply configuration first"});let a=(0,v.readFileSync)(A,"utf-8");try{e=JSON.parse(a)}catch{return m.NextResponse.json({success:!1,error:"Invalid configuration format"})}let s=((e.models||{}).providers||{})["aar-gateway"],n={baseUrl:s?.baseUrl,apiKey:(t=s?.apiKey||"")&&"your-gateway-api-key"!==t?t.length<=8?t.slice(0,2)+"***"+t.slice(-2):t.slice(0,4)+"****"+t.slice(-4):t,routerProvider:s?"aar":void 0},o=e.agents?.defaults?.model?.primary;o&&(n.primaryModel=o);let i=e.agents?.defaults?.model?.fallbacks;Array.isArray(i)&&(n.fallbackModels=i);let l=e.agents?.defaults?.imageModel?.primary;l&&(n.imageModel=l);let d=e.agents?.defaults?.imageModel?.fallbacks;Array.isArray(d)&&(n.fallbackImageModels=d);let u=await (r=["models","status","--probe","--probe-provider","aar-gateway","--json"],new Promise(e=>{let t=(0,C.spawn)("openclaw",r,{shell:"win32"===process.platform,stdio:["ignore","pipe","pipe"]}),a="",s="";t.stdout?.on("data",e=>{a+=e.toString("utf-8")}),t.stderr?.on("data",e=>{s+=e.toString("utf-8")}),t.on("error",t=>{e({success:!1,stdout:a,stderr:s,error:t.message})}),t.on("close",t=>{e({success:0===t,stdout:a,stderr:s,code:t??void 0})}),setTimeout(()=>{t.killed||(t.kill(),e({success:!1,stdout:a,stderr:s,error:"Timeout"}))},3e4)})),c=!1;if(u.success)try{let e=JSON.parse(u.stdout);(c=e?.success===!0||e?.status==="ok")||e?.message}catch{c=u.stdout.toLowerCase().includes("ok")||u.stdout.toLowerCase().includes("success")||u.stdout.toLowerCase().includes("aar-gateway")}else u.error||u.code;let p={hasBaseUrl:!!s?.baseUrl,hasApiKey:!!s?.apiKey&&s?.apiKey!=="your-gateway-api-key",hasModels:Array.isArray(s?.models)&&s.models.length>0,hasPrimaryModel:!!o,hasProvider:!!s,probeSuccess:c},h=p.hasBaseUrl&&p.hasApiKey&&p.hasProvider&&c,g={success:h,message:h?"Configuration verified successfully":"Configuration verification failed",checks:p,configSummary:n,probeResult:{success:c,stdout:u.stdout.slice(-3e3),stderr:u.stderr.slice(-500),error:u.error}};return m.NextResponse.json(g)}catch(e){return console.error("OpenClaw Test API error:",e),m.NextResponse.json({success:!1,error:e.message||"Internal server error"})}}e.s(["GET",()=>b],53513);var k=e.i(53513);let P=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/openclaw/test/route",pathname:"/api/ide/openclaw/test",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/openclaw/test/route.ts",nextConfigOutput:"",userland:k}),{workAsyncStorage:N,workUnitAsyncStorage:T,serverHooks:j}=P;function S(){return(0,a.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:T})}async function O(e,t,a){P.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/ide/openclaw/test/route";m=m.replace(/\/index$/,"")||"/";let v=await P.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,params:w,nextConfig:C,parsedUrl:E,isDraftMode:A,prerenderManifest:b,routerServerContext:k,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,resolvedPathname:j,clientReferenceManifest:S,serverActionsManifest:O}=v,q=(0,i.normalizeAppPath)(m),_=!!(b.dynamicRoutes[q]||b.routes[j]),U=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,E,!1):t.end("This page could not be found"),null);if(_&&!A){let e=!!b.routes[j],t=b.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(C.experimental.adapterPath)return await U();throw new f.NoFallbackError}}let M=null;!_||P.isDev||A||(M="/index"===(M=j)?"/":M);let I=!0===P.isDev||!_,H=_&&!I;O&&S&&(0,o.setManifestsSingleton)({page:m,clientReferenceManifest:S,serverActionsManifest:O});let K=e.method||"GET",D=(0,n.getTracer)(),F=D.getActiveScopeSpan(),$={params:w,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:I,incrementalCache:(0,s.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:C.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,s)=>P.onRequestError(e,t,a,s,k)},sharedContext:{buildId:R}},L=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(L,(0,d.signalFromNodeResponse)(t));try{let o=async e=>P.handle(G,$).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 a=r.get("next.route");if(a){let t=`${K} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${K} ${m}`)}),i=!!(0,s.getRequestMeta)(e,"minimalMode"),l=async s=>{var n,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&N&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await o(s);e.fetchMetrics=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=$.renderOpts.collectedTags;if(!_)return await (0,p.sendResponse)(L,B,n,$.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);d&&(t[x.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,a=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await P.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:N})},!1,k),t}},u=await P.handleResponse({req:e,nextConfig:C,cacheKey:M,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:T,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:i});if(!_)return null;if((null==u||null==(n=u.value)?void 0:n.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&_||f.delete(x.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,g.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(L,B,new Response(u.value.body,{headers:f,status:u.value.status||200})),null};F?await l(F):await D.withPropagatedContext(e.headers,()=>D.trace(u.BaseServerSpan.handleRequest,{spanName:`${K} ${m}`,kind:n.SpanKind.SERVER,attributes:{"http.method":K,"http.target":e.url}},l))}catch(t){if(t instanceof f.NoFallbackError||await P.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:N})},!1,k),_)throw t;return await (0,p.sendResponse)(L,B,new Response(null,{status:500})),null}}e.s(["handler",()=>O,"patchFetch",()=>S,"routeModule",()=>P,"serverHooks",()=>j,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>T],51523)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__dc8b0bed._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/app/api/ide/openclaw/test/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { existsSync, readFileSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { spawn } from 'child_process';\n\nconst OPENCLAW_DIR = join(homedir(), '.openclaw');\nconst OPENCLAW_FILE = join(OPENCLAW_DIR, 'openclaw.json');\n\nconst RUN_TIMEOUT_MS = 30_000;\n\ninterface TestResult {\n success: boolean;\n error?: string;\n message?: string;\n checks?: Record<string, boolean>;\n configSummary?: {\n baseUrl?: string;\n apiKey?: string;\n routerProvider?: string;\n primaryModel?: string;\n fallbackModels?: string[];\n imageModel?: string;\n fallbackImageModels?: string[];\n };\n probeResult?: {\n success: boolean;\n stdout: string;\n stderr: string;\n error?: string;\n };\n}\n\nfunction runCommand(args: string[]): Promise<{ success: boolean; stdout: string; stderr: string; error?: string; code?: number }> {\n return new Promise((resolve) => {\n const child = spawn('openclaw', args, {\n shell: process.platform === 'win32',\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stdout = '';\n let stderr = '';\n\n child.stdout?.on('data', (chunk: Buffer) => {\n stdout += chunk.toString('utf-8');\n });\n child.stderr?.on('data', (chunk: Buffer) => {\n stderr += chunk.toString('utf-8');\n });\n\n child.on('error', (err) => {\n resolve({ success: false, stdout, stderr, error: err.message });\n });\n\n child.on('close', (code) => {\n resolve({ success: code === 0, stdout, stderr, code: code ?? undefined });\n });\n\n setTimeout(() => {\n if (!child.killed) {\n child.kill();\n resolve({ success: false, stdout, stderr, error: 'Timeout' });\n }\n }, RUN_TIMEOUT_MS);\n });\n}\n\nfunction maskApiKey(apiKey: string): string {\n if (!apiKey || apiKey === 'your-gateway-api-key') return apiKey;\n if (apiKey.length <= 8) return apiKey.slice(0, 2) + '***' + apiKey.slice(-2);\n return apiKey.slice(0, 4) + '****' + apiKey.slice(-4);\n}\n\nexport async function GET(request: NextRequest) {\n try {\n // Check config file exists\n if (!existsSync(OPENCLAW_FILE)) {\n return NextResponse.json({\n success: false,\n error: 'Configuration file not found',\n suggestion: 'Please apply configuration first',\n } as TestResult);\n }\n\n const content = readFileSync(OPENCLAW_FILE, 'utf-8');\n let config: any;\n try {\n config = JSON.parse(content);\n } catch {\n return NextResponse.json({\n success: false,\n error: 'Invalid configuration format',\n } as TestResult);\n }\n\n // Extract config summary\n const modelsConfig = config.models || {};\n const providers = modelsConfig.providers || {};\n const aarProvider = providers['aar-gateway'];\n\n const configSummary: TestResult['configSummary'] = {\n baseUrl: aarProvider?.baseUrl,\n apiKey: maskApiKey(aarProvider?.apiKey || ''),\n routerProvider: aarProvider ? 'aar' : undefined,\n };\n\n const primaryModel = config.agents?.defaults?.model?.primary;\n if (primaryModel) {\n configSummary.primaryModel = primaryModel;\n }\n\n const fallbackModels = config.agents?.defaults?.model?.fallbacks;\n if (Array.isArray(fallbackModels)) {\n configSummary.fallbackModels = fallbackModels;\n }\n\n const imageModel = config.agents?.defaults?.imageModel?.primary;\n if (imageModel) {\n configSummary.imageModel = imageModel;\n }\n\n const fallbackImageModels = config.agents?.defaults?.imageModel?.fallbacks;\n if (Array.isArray(fallbackImageModels)) {\n configSummary.fallbackImageModels = fallbackImageModels;\n }\n\n // Run probe command to test provider accessibility\n const probeResult = await runCommand([\n 'models', 'status',\n '--probe',\n '--probe-provider', 'aar-gateway',\n '--json'\n ]);\n\n let probeSuccess = false;\n let probeMessage = 'Provider not found or not accessible';\n\n if (probeResult.success) {\n // Try to parse JSON output\n try {\n const parsed = JSON.parse(probeResult.stdout);\n // Check if probe was successful\n probeSuccess = parsed?.success === true || parsed?.status === 'ok';\n if (probeSuccess) {\n probeMessage = 'Provider is accessible and responding';\n } else {\n probeMessage = parsed?.message || 'Probe returned unsuccessful status';\n }\n } catch {\n // If not JSON, check for success indicators in text\n probeSuccess = probeResult.stdout.toLowerCase().includes('ok') ||\n probeResult.stdout.toLowerCase().includes('success') ||\n probeResult.stdout.toLowerCase().includes('aar-gateway');\n probeMessage = probeSuccess\n ? 'Provider is accessible'\n : 'Could not verify provider status';\n }\n } else {\n probeMessage = probeResult.error || `Command failed (code ${probeResult.code})`;\n }\n\n const checks: Record<string, boolean> = {\n hasBaseUrl: !!aarProvider?.baseUrl,\n hasApiKey: !!aarProvider?.apiKey && aarProvider?.apiKey !== 'your-gateway-api-key',\n hasModels: Array.isArray(aarProvider?.models) && aarProvider.models.length > 0,\n hasPrimaryModel: !!primaryModel,\n hasProvider: !!aarProvider,\n probeSuccess,\n };\n\n const success = checks.hasBaseUrl && checks.hasApiKey && checks.hasProvider && probeSuccess;\n\n const result: TestResult = {\n success,\n message: success ? 'Configuration verified successfully' : 'Configuration verification failed',\n checks,\n configSummary,\n probeResult: {\n success: probeSuccess,\n stdout: probeResult.stdout.slice(-3000),\n stderr: probeResult.stderr.slice(-500),\n error: probeResult.error,\n },\n };\n\n return NextResponse.json(result);\n } catch (error: any) {\n console.error('OpenClaw Test API error:', error);\n return NextResponse.json({\n success: false,\n error: error.message || 'Internal server error',\n } as TestResult);\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 } 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/test/route\",\n pathname: \"/api/ide/openclaw/test\",\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/test/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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/ide/openclaw/test/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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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.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ist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},37765,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=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),x=e.i(70101),h=e.i(26937),R=e.i(10372),g=e.i(93695);e.i(52474);var f=e.i(220),v=e.i(89171),w=e.i(71560),m=e.i(97731);async function y(e){try{await (0,w.getDatabase)();let{searchParams:t}=new URL(e.url),r=t.get("key");if(r){let e=await (0,m.getConfig)(r);if(!e)return v.NextResponse.json({error:"Config not found"},{status:404});return v.NextResponse.json(e)}let n=await (0,m.getAllConfig)();return v.NextResponse.json(n)}catch(e){return console.error("Config API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function E(e){try{await (0,w.getDatabase)();let{key:t,value:r}=await e.json();if(!t)return v.NextResponse.json({error:"Key is required"},{status:400});let n=await (0,m.setConfig)(t,null==r?"":"string"==typeof r?r:JSON.stringify(r));return v.NextResponse.json(n)}catch(e){return console.error("Config POST API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["GET",()=>y,"POST",()=>E,"runtime",0,"nodejs"],77025);var C=e.i(77025);let A=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/config/route",pathname:"/api/config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/config/route.ts",nextConfigOutput:"",userland:C}),{workAsyncStorage:N,workUnitAsyncStorage:b,serverHooks:P}=A;function T(){return(0,n.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:b})}async function j(e,t,n){A.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/config/route";v=v.replace(/\/index$/,"")||"/";let w=await A.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:m,params:y,nextConfig:E,parsedUrl:C,isDraftMode:N,prerenderManifest:b,routerServerContext:P,isOnDemandRevalidate:T,revalidateOnlyGenerated:j,resolvedPathname:k,clientReferenceManifest:O,serverActionsManifest:q}=w,S=(0,i.normalizeAppPath)(v),_=!!(b.dynamicRoutes[S]||b.routes[k]),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(_&&!N){let e=!!b.routes[k],t=b.dynamicRoutes[S];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await I();throw new g.NoFallbackError}}let H=null;!_||A.isDev||N||(H="/index"===(H=k)?"/":H);let U=!0===A.isDev||!_,D=_&&!U;q&&O&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:O,serverActionsManifest:q});let M=e.method||"GET",K=(0,s.getTracer)(),$=K.getActiveScopeSpan(),F={params:y,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>A.onRequestError(e,t,n,a,P)},sharedContext:{buildId:m}},L=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(L,(0,d.signalFromNodeResponse)(t));try{let o=async e=>A.handle(G,F).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=K.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 n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${v}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&T&&j&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(a);e.fetchMetrics=F.renderOpts.fetchMetrics;let l=F.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=F.renderOpts.collectedTags;if(!_)return await (0,c.sendResponse)(L,B,s,F.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[R.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,n=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:f.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await A.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,P),t}},u=await A.handleResponse({req:e,nextConfig:E,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:j,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:i});if(!_)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==f.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,x.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&_||g.delete(R.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(L,B,new Response(u.value.body,{headers:g,status:u.value.status||200})),null};$?await l($):await K.withPropagatedContext(e.headers,()=>K.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await A.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,P),_)throw t;return await (0,c.sendResponse)(L,B,new Response(null,{status:500})),null}}e.s(["handler",()=>j,"patchFetch",()=>T,"routeModule",()=>A,"serverHooks",()=>P,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>b],37765)}];
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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},37765,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=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),x=e.i(70101),h=e.i(26937),g=e.i(10372),f=e.i(93695);e.i(52474);var R=e.i(220),v=e.i(89171),w=e.i(71560),y=e.i(97731),m=e.i(54799);async function C(e){try{await (0,w.getDatabase)();let{searchParams:t}=new URL(e.url),r=t.get("key");if(r){let e=await (0,y.getConfig)(r);if(!e)return v.NextResponse.json({error:"Config not found"},{status:404});return v.NextResponse.json(e)}let n=await (0,y.getAllConfig)();if(!n.api_key){let e=`aar-${m.default.randomBytes(16).toString("hex")}`;await (0,y.setConfig)("api_key",e),n.api_key=e,console.log("[Config API] Generated default API key")}return v.NextResponse.json(n)}catch(e){return console.error("Config API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function E(e){try{await (0,w.getDatabase)();let{key:t,value:r}=await e.json();if(!t)return v.NextResponse.json({error:"Key is required"},{status:400});let n=await (0,y.setConfig)(t,null==r?"":"string"==typeof r?r:JSON.stringify(r));return v.NextResponse.json(n)}catch(e){return console.error("Config POST API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["GET",()=>C,"POST",()=>E,"runtime",0,"nodejs"],77025);var A=e.i(77025);let N=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/config/route",pathname:"/api/config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/config/route.ts",nextConfigOutput:"",userland:A}),{workAsyncStorage:b,workUnitAsyncStorage:P,serverHooks:k}=N;function T(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:P})}async function j(e,t,n){N.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/config/route";v=v.replace(/\/index$/,"")||"/";let w=await N.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,params:m,nextConfig:C,parsedUrl:E,isDraftMode:A,prerenderManifest:b,routerServerContext:P,isOnDemandRevalidate:k,revalidateOnlyGenerated:T,resolvedPathname:j,clientReferenceManifest:O,serverActionsManifest:S}=w,_=(0,i.normalizeAppPath)(v),q=!!(b.dynamicRoutes[_]||b.routes[j]),I=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,E,!1):t.end("This page could not be found"),null);if(q&&!A){let e=!!b.routes[j],t=b.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(C.experimental.adapterPath)return await I();throw new f.NoFallbackError}}let H=null;!q||N.isDev||A||(H="/index"===(H=j)?"/":H);let U=!0===N.isDev||!q,D=q&&!U;S&&O&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:O,serverActionsManifest:S});let M=e.method||"GET",$=(0,o.getTracer)(),K=$.getActiveScopeSpan(),F={params:m,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:C.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>N.onRequestError(e,t,n,a,P)},sharedContext:{buildId:y}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let s=async e=>N.handle(G,F).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 n=r.get("next.route");if(n){let t=`${M} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${v}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var o,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&k&&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(a);e.fetchMetrics=F.renderOpts.fetchMetrics;let l=F.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let d=F.renderOpts.collectedTags;if(!q)return await (0,c.sendResponse)(B,L,o,F.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[g.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,n=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await N.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:k})},!1,P),t}},u=await N.handleResponse({req:e,nextConfig:C,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:T,responseGenerator:d,waitUntil:n.waitUntil,isMinimalMode:i});if(!q)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",k?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,x.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&q||f.delete(g.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(B,L,new Response(u.value.body,{headers:f,status:u.value.status||200})),null};K?await l(K):await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${v}`,kind:o.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof f.NoFallbackError||await N.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:k})},!1,P),q)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>j,"patchFetch",()=>T,"routeModule",()=>N,"serverHooks",()=>k,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>P],37765)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__f0461b8d._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/app/api/config/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getDatabase } from '@/db/database';\nimport { getConfig, setConfig, getAllConfig } from '@/db/queries';\n\n// Ensure Node.js runtime (required for SQLite)\nexport const runtime = 'nodejs';\n\nexport async function GET(request: NextRequest) {\n try {\n // Initialize database on request (safer than module load)\n await getDatabase();\n\n const { searchParams } = new URL(request.url);\n const key = searchParams.get('key');\n\n if (key) {\n const config = await getConfig(key);\n if (!config) {\n return NextResponse.json(\n { error: 'Config not found' },\n { status: 404 }\n );\n }\n return NextResponse.json(config);\n }\n\n const configs = await getAllConfig();\n return NextResponse.json(configs);\n } catch (error: any) {\n console.error('Config 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\nexport async function POST(request: NextRequest) {\n try {\n // Initialize database on request\n await getDatabase();\n\n const body = await request.json();\n const { key, value } = body;\n\n if (!key) {\n return NextResponse.json(\n { error: 'Key is required' },\n { status: 400 }\n );\n }\n\n // Allow value to be null, undefined, or empty string (save as empty string)\n const config = await setConfig(key, (value === undefined || value === null) ? '' : typeof value === 'string' ? value : JSON.stringify(value));\n\n return NextResponse.json(config);\n } catch (error: any) {\n console.error('Config POST 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 } 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/config/route\",\n pathname: \"/api/config\",\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/config/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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/config/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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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}\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f,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,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,EAEA,qCAAqC","ignoreList":[1]}
1
+ {"version":3,"sources":["../../../src/app/api/config/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getDatabase } from '@/db/database';\nimport { getConfig, setConfig, getAllConfig } from '@/db/queries';\nimport crypto from 'crypto';\n\n// Ensure Node.js runtime (required for SQLite)\nexport const runtime = 'nodejs';\n\n/**\n * 生成随机的 API Key(用于网关密码默认值)\n */\nfunction generateRandomApiKey(): string {\n return `aar-${crypto.randomBytes(16).toString('hex')}`;\n}\n\nexport async function GET(request: NextRequest) {\n try {\n // Initialize database on request (safer than module load)\n await getDatabase();\n\n const { searchParams } = new URL(request.url);\n const key = searchParams.get('key');\n\n if (key) {\n const config = await getConfig(key);\n if (!config) {\n return NextResponse.json(\n { error: 'Config not found' },\n { status: 404 }\n );\n }\n return NextResponse.json(config);\n }\n\n const configs = await getAllConfig();\n \n // 如果 api_key 为空,生成一个随机默认值\n if (!configs.api_key) {\n const defaultApiKey = generateRandomApiKey();\n await setConfig('api_key', defaultApiKey);\n configs.api_key = defaultApiKey;\n console.log('[Config API] Generated default API key');\n }\n \n return NextResponse.json(configs);\n } catch (error: any) {\n console.error('Config 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\nexport async function POST(request: NextRequest) {\n try {\n // Initialize database on request\n await getDatabase();\n\n const body = await request.json();\n const { key, value } = body;\n\n if (!key) {\n return NextResponse.json(\n { error: 'Key is required' },\n { status: 400 }\n );\n }\n\n // Allow value to be null, undefined, or empty string (save as empty string)\n const config = await setConfig(key, (value === undefined || value === null) ? '' : typeof value === 'string' ? value : JSON.stringify(value));\n\n return NextResponse.json(config);\n } catch (error: any) {\n console.error('Config POST 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 } 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/config/route\",\n pathname: \"/api/config\",\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/config/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 (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/config/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.experimental.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 context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, '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 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 } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\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 (activeSpan) {\n await handleResponse(activeSpan);\n } else {\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));\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":[],"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,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAYO,eAAe,EAAI,CAAoB,EAC5C,GAAI,CAEF,MAAM,CAAA,EAAA,EAAA,WAAA,AAAW,IAEjB,GAAM,cAAE,CAAY,CAAE,CAAG,IAAI,IAAI,EAAQ,GAAG,EACtC,EAAM,EAAa,GAAG,CAAC,OAE7B,GAAI,EAAK,CACP,IAAM,EAAS,MAAM,CAAA,EAA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AA,sBAAsB,GAIrC,EAAW,YAAY,EAAK,EAAD,AAAK,SAAS,CAAC,kBAAqB,EAAQ,AAAT,GAAY,CAAC,kBAAkB,AAC7F,EAAQ,GAAG,CAAC,gBAAiB,CAAA,EAAA,EAAA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,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,GAEf,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,EAEA,qCAAqC","ignoreList":[1]}
@@ -1,3 +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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},88441,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),x=e.i(26937),R=e.i(10372),g=e.i(93695);e.i(52474);var E=e.i(220),v=e.i(89171),f=e.i(22734),y=e.i(14747),m=e.i(46786),A=e.i(71560),O=e.i(97731);let C=(0,y.join)((0,m.homedir)(),".claude"),N=(0,y.join)(C,"settings.json"),_=(0,y.join)(C,"settings.json.aar.bak"),w=(0,y.join)((0,m.homedir)(),".aar"),T=(0,y.join)(w,"settings.tmp.json");async function P(t){try{let t,r,a,n=(0,f.existsSync)(N),s=(0,f.existsSync)(_);await (0,A.getDatabase)();let o=await (0,O.getConfig)("api_key"),i=await (0,O.getConfig)("port"),l=o?.value||"your-gateway-api-key",d=`http://localhost:${i?.value||"1357"}`;if(!n)return v.NextResponse.json({applied:!1,modelMapping:{},gatewayAddress:d,apiKey:I(l),backupExists:!1,lastUpdated:void 0,matchCurrentGateway:!1,routerProvider:void 0});let u=(0,f.readFileSync)(N,"utf-8");try{a=JSON.parse(u)}catch(e){return v.NextResponse.json({error:"Invalid settings.json format"},{status:500})}let p=a.env?.ANTHROPIC_BASE_URL,c=a.env?.ANTHROPIC_AUTH_TOKEN,h=p===d&&c===l,x={};if(!h&&(0,f.existsSync)(T))try{let e=(0,f.readFileSync)(T,"utf-8"),t=JSON.parse(e);t.modelMapping&&(x=t.modelMapping,console.log("[IDE Status] Loading temporary config:",x))}catch(e){console.error("[IDE Status] Failed to parse temp config:",e)}let R={applied:!0,modelMapping:(t=a.env||{},r={},t.ANTHROPIC_DEFAULT_HAIKU_MODEL&&(r.haiku=t.ANTHROPIC_DEFAULT_HAIKU_MODEL),t.ANTHROPIC_DEFAULT_SONNET_MODEL&&(r.sonnet=t.ANTHROPIC_DEFAULT_SONNET_MODEL),t.ANTHROPIC_DEFAULT_OPUS_MODEL&&(r.opus=t.ANTHROPIC_DEFAULT_OPUS_MODEL),t.ANTHROPIC_MODEL&&(r.default=t.ANTHROPIC_MODEL),t.ANTHROPIC_REASONING_MODEL&&(r.reasoning=t.ANTHROPIC_REASONING_MODEL),r),gatewayAddress:p,apiKey:I(c||l),backupExists:s,lastUpdated:function(){let{statSync:t}=e.r(22734);try{let e=t(N);return new Date(e.mtime).toISOString()}catch(e){return null}}()||null,matchCurrentGateway:h,routerProvider:a.router_provider,tempMapping:x};return v.NextResponse.json(R)}catch(e){return console.error("IDE Status API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}function I(e){return e&&"your-gateway-api-key"!==e?e.length<=8?e.slice(0,2)+"***"+e.slice(-2):e.slice(0,4)+"****"+e.slice(-4):e}e.s(["GET",()=>P],35912);var S=e.i(35912);let D=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/claude/status/route",pathname:"/api/ide/claude/status",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/claude/status/route.ts",nextConfigOutput:"",userland:S}),{workAsyncStorage:H,workUnitAsyncStorage:b,serverHooks:j}=D;function U(){return(0,a.patchFetch)({workAsyncStorage:H,workUnitAsyncStorage:b})}async function k(e,t,a){D.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/ide/claude/status/route";v=v.replace(/\/index$/,"")||"/";let f=await D.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,params:m,nextConfig:A,parsedUrl:O,isDraftMode:C,prerenderManifest:N,routerServerContext:_,isOnDemandRevalidate:w,revalidateOnlyGenerated:T,resolvedPathname:P,clientReferenceManifest:I,serverActionsManifest:S}=f,H=(0,i.normalizeAppPath)(v),b=!!(N.dynamicRoutes[H]||N.routes[P]),j=async()=>((null==_?void 0:_.render404)?await _.render404(e,t,O,!1):t.end("This page could not be found"),null);if(b&&!C){let e=!!N.routes[P],t=N.dynamicRoutes[H];if(t&&!1===t.fallback&&!e){if(A.experimental.adapterPath)return await j();throw new g.NoFallbackError}}let U=null;!b||D.isDev||C||(U="/index"===(U=P)?"/":U);let k=!0===D.isDev||!b,M=b&&!k;S&&I&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:I,serverActionsManifest:S});let L=e.method||"GET",q=(0,s.getTracer)(),F=q.getActiveScopeSpan(),K={params:m,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts},cacheComponents:!!A.cacheComponents,supportsDynamicResponse:k,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:A.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>D.onRequestError(e,t,a,n,_)},sharedContext:{buildId:y}},$=new l.NodeNextRequest(e),G=new l.NodeNextResponse(t),B=d.NextRequestAdapter.fromNodeNextRequest($,(0,d.signalFromNodeResponse)(t));try{let o=async e=>D.handle(B,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=q.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=`${L} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${L} ${v}`)}),i=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!i&&w&&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=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=K.renderOpts.collectedTags;if(!b)return await (0,c.sendResponse)($,G,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[R.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:E.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 D.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:w})},!1,_),t}},u=await D.handleResponse({req:e,nextConfig:A,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:w,revalidateOnlyGenerated:T,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:i});if(!b)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==E.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",w?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return i&&b||g.delete(R.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,x.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)($,G,new Response(u.value.body,{headers:g,status:u.value.status||200})),null};F?await l(F):await q.withPropagatedContext(e.headers,()=>q.trace(u.BaseServerSpan.handleRequest,{spanName:`${L} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await D.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:w})},!1,_),b)throw t;return await (0,c.sendResponse)($,G,new Response(null,{status:500})),null}}e.s(["handler",()=>k,"patchFetch",()=>U,"routeModule",()=>D,"serverHooks",()=>j,"workAsyncStorage",()=>H,"workUnitAsyncStorage",()=>b],88441)}];
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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},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"))},88441,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=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),p=e.i(47587),c=e.i(66012),h=e.i(70101),x=e.i(26937),R=e.i(10372),g=e.i(93695);e.i(52474);var E=e.i(220),v=e.i(89171),y=e.i(22734),A=e.i(14747),f=e.i(46786),m=e.i(71560),w=e.i(97731);let O=(0,A.join)((0,f.homedir)(),".claude"),C=(0,A.join)(O,"settings.json"),N=(0,A.join)(O,"settings.json.aar.bak"),_=(0,A.join)((0,f.homedir)(),".aar"),T=(0,A.join)(_,"settings.tmp.json");async function P(t){try{let t,r,a,n=(0,y.existsSync)(C),s=(0,y.existsSync)(N);await (0,m.getDatabase)();let i=await (0,w.getConfig)("api_key"),o=await (0,w.getConfig)("port"),l=i?.value||"your-gateway-api-key",d=`http://localhost:${o?.value||"1357"}`;if(!n)return v.NextResponse.json({applied:!1,modelMapping:{},gatewayAddress:d,apiKey:I(l),backupExists:!1,lastUpdated:void 0,matchCurrentGateway:!1,routerProvider:void 0,currentGatewayAddress:d,currentGatewayApiKey:l});let u=(0,y.readFileSync)(C,"utf-8");try{a=JSON.parse(u)}catch(e){return v.NextResponse.json({error:"Invalid settings.json format"},{status:500})}let p=a.env?.ANTHROPIC_BASE_URL,c=a.env?.ANTHROPIC_AUTH_TOKEN,h=p===d&&c===l,x={};if(!h&&(0,y.existsSync)(T))try{let e=(0,y.readFileSync)(T,"utf-8"),t=JSON.parse(e);t.modelMapping&&(x=t.modelMapping,console.log("[IDE Status] Loading temporary config:",x))}catch(e){console.error("[IDE Status] Failed to parse temp config:",e)}let R={applied:!0,modelMapping:(t=a.env||{},r={},t.ANTHROPIC_DEFAULT_HAIKU_MODEL&&(r.haiku=t.ANTHROPIC_DEFAULT_HAIKU_MODEL),t.ANTHROPIC_DEFAULT_SONNET_MODEL&&(r.sonnet=t.ANTHROPIC_DEFAULT_SONNET_MODEL),t.ANTHROPIC_DEFAULT_OPUS_MODEL&&(r.opus=t.ANTHROPIC_DEFAULT_OPUS_MODEL),t.ANTHROPIC_MODEL&&(r.default=t.ANTHROPIC_MODEL),t.ANTHROPIC_REASONING_MODEL&&(r.reasoning=t.ANTHROPIC_REASONING_MODEL),r),gatewayAddress:p,apiKey:I(c||l),backupExists:s,lastUpdated:function(){let{statSync:t}=e.r(22734);try{let e=t(C);return new Date(e.mtime).toISOString()}catch(e){return null}}()||null,matchCurrentGateway:h,routerProvider:a.router_provider,tempMapping:x,config:a,currentGatewayAddress:d,currentGatewayApiKey:l};return v.NextResponse.json(R)}catch(e){return console.error("IDE Status API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}function I(e){return e&&"your-gateway-api-key"!==e?e.length<=8?e.slice(0,2)+"***"+e.slice(-2):e.slice(0,4)+"****"+e.slice(-4):e}e.s(["GET",()=>P],35912);var S=e.i(35912);let D=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/claude/status/route",pathname:"/api/ide/claude/status",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/claude/status/route.ts",nextConfigOutput:"",userland:S}),{workAsyncStorage:H,workUnitAsyncStorage:b,serverHooks:j}=D;function U(){return(0,a.patchFetch)({workAsyncStorage:H,workUnitAsyncStorage:b})}async function k(e,t,a){D.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/ide/claude/status/route";v=v.replace(/\/index$/,"")||"/";let y=await D.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:A,params:f,nextConfig:m,parsedUrl:w,isDraftMode:O,prerenderManifest:C,routerServerContext:N,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,resolvedPathname:P,clientReferenceManifest:I,serverActionsManifest:S}=y,H=(0,o.normalizeAppPath)(v),b=!!(C.dynamicRoutes[H]||C.routes[P]),j=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,w,!1):t.end("This page could not be found"),null);if(b&&!O){let e=!!C.routes[P],t=C.dynamicRoutes[H];if(t&&!1===t.fallback&&!e){if(m.experimental.adapterPath)return await j();throw new g.NoFallbackError}}let U=null;!b||D.isDev||O||(U="/index"===(U=P)?"/":U);let k=!0===D.isDev||!b,M=b&&!k;S&&I&&(0,i.setManifestsSingleton)({page:v,clientReferenceManifest:I,serverActionsManifest:S});let L=e.method||"GET",q=(0,s.getTracer)(),F=q.getActiveScopeSpan(),K={params:f,prerenderManifest:C,renderOpts:{experimental:{authInterrupts:!!m.experimental.authInterrupts},cacheComponents:!!m.cacheComponents,supportsDynamicResponse:k,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:m.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>D.onRequestError(e,t,a,n,N)},sharedContext:{buildId:A}},G=new l.NodeNextRequest(e),$=new l.NodeNextResponse(t),B=d.NextRequestAdapter.fromNodeNextRequest(G,(0,d.signalFromNodeResponse)(t));try{let i=async e=>D.handle(B,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=q.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=`${L} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${L} ${v}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&_&&T&&!r)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=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=K.renderOpts.collectedTags;if(!b)return await (0,c.sendResponse)(G,$,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[R.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:E.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 D.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:_})},!1,N),t}},u=await D.handleResponse({req:e,nextConfig:m,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!b)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==E.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",_?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),O&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&b||g.delete(R.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,x.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(G,$,new Response(u.value.body,{headers:g,status:u.value.status||200})),null};F?await l(F):await q.withPropagatedContext(e.headers,()=>q.trace(u.BaseServerSpan.handleRequest,{spanName:`${L} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await D.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:_})},!1,N),b)throw t;return await (0,c.sendResponse)(G,$,new Response(null,{status:500})),null}}e.s(["handler",()=>k,"patchFetch",()=>U,"routeModule",()=>D,"serverHooks",()=>j,"workAsyncStorage",()=>H,"workUnitAsyncStorage",()=>b],88441)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__f8949f88._.js.map