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 @@
1
+ {"version":3,"sources":["../../../src/app/api/ide/opencode/available-models/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getAllModels, getProviderById } from '@/db/queries';\n\ntype AvailableModel = {\n id: number;\n name: string;\n model_id: string;\n provider_id: number;\n provider_name: string;\n enabled: boolean;\n};\n\ntype GroupedModels = { [providerName: string]: AvailableModel[] };\n\n/**\n * 查询可用模型列表(与 Claude 共用网关,用于 OpenCode 配置)\n */\nexport async function GET(request: NextRequest) {\n try {\n const allModels = (await getAllModels()).filter((m: any) => m.enabled);\n\n if (allModels.length === 0) {\n return NextResponse.json({\n models: {},\n count: 0,\n message: 'No enabled models found. Please enable some models first.',\n });\n }\n\n const grouped = await allModels.reduce(async (acc: Promise<GroupedModels>, model: any) => {\n const resolvedAcc = await acc;\n const provider = await getProviderById(model.provider_id);\n if (provider) {\n if (!resolvedAcc[provider.name]) resolvedAcc[provider.name] = [];\n resolvedAcc[provider.name].push({\n id: model.id,\n name: model.name,\n model_id: model.model_id,\n provider_id: model.provider_id,\n provider_name: provider.name,\n enabled: model.enabled,\n });\n }\n return resolvedAcc;\n }, Promise.resolve({} as GroupedModels));\n\n return NextResponse.json({\n models: grouped,\n count: allModels.length,\n providers: Object.keys(grouped),\n });\n } catch (error: any) {\n console.error('OpenCode Available Models API error:', error);\n return NextResponse.json(\n { error: error.message || 'Internal server error', stack: process.env.NODE_ENV === 'development' ? error.stack : undefined },\n { status: 500 }\n );\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/ide/opencode/available-models/route\",\n pathname: \"/api/ide/opencode/available-models\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/ide/opencode/available-models/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/ide/opencode/available-models/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.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,OAgBO,eAAe,EAAI,CAAoB,EAC5C,GAAI,CACF,IAAM,EAAY,CAAC,MAAM,CAAA,EAAA,EAAA,YAAA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,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"))},56048,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),v=e.i(70101),R=e.i(26937),h=e.i(10372),E=e.i(93695);e.i(52474);var g=e.i(220),x=e.i(89171),A=e.i(22734),O=e.i(14747),_=e.i(46786),f=e.i(71560),C=e.i(97731);let T=(0,O.join)((0,_.homedir)(),".claude"),N=(0,O.join)(T,"settings.json"),m=(0,O.join)((0,_.homedir)(),".aar"),w=(0,O.join)(m,"settings.tmp.json");async function y(e){try{var t,r,a;let n,s,i,{haiku:o,sonnet:l,opus:d,default:u,reasoning:p}=await e.json();if(void 0===o&&void 0===l&&void 0===d&&void 0===u&&void 0===p)return x.NextResponse.json({error:"No model settings provided"},{status:400});let c=await I(),v=await P(),R=(0,A.existsSync)(N),h=!1;if(R){let e=JSON.parse((0,A.readFileSync)(N,"utf-8")),t=e.env?.ANTHROPIC_BASE_URL,r=e.env?.ANTHROPIC_AUTH_TOKEN;h=t===c&&r===v}R&&h?(n=N,s="applied",t=c,r=v,a={haiku:o,sonnet:l,opus:d,default:u,reasoning:p},i={router_provider:"aar",env:{ANTHROPIC_AUTH_TOKEN:r,ANTHROPIC_BASE_URL:t,ANTHROPIC_DEFAULT_HAIKU_MODEL:a.haiku,ANTHROPIC_DEFAULT_OPUS_MODEL:a.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:a.sonnet,ANTHROPIC_MODEL:a.default,ANTHROPIC_REASONING_MODEL:a.reasoning,API_TIMEOUT_MS:"3000000",CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:1,hasCompletedOnboarding:!0}}):(n=w,s="temp",i={modelMapping:{haiku:o,sonnet:l,opus:d,default:u,reasoning:p},isTemp:!0,savedAt:new Date().toISOString()});let E=n===N?T:m;(0,A.existsSync)(E)||(0,A.mkdirSync)(E,{recursive:!0});let g=JSON.stringify(i,null,2);return(0,A.writeFileSync)(n,g,"utf-8"),console.log("[IDE Save] Configuration saved:",{saveType:s,savePath:n,isCurrentGatewayApplied:h,config:"temp"===s?i:{baseUrl:i.env?.ANTHROPIC_BASE_URL,hasApiKey:!!i.env?.ANTHROPIC_AUTH_TOKEN,modelMapping:{haiku:i.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,sonnet:i.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,opus:i.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,default:i.env?.ANTHROPIC_MODEL,reasoning:i.env?.ANTHROPIC_REASONING_MODEL}}}),x.NextResponse.json({success:!0,message:"applied"===s?"配置已更新到 Claude Code":"配置已保存(临时)",saveType:s,savePath:n===N?"~/.claude/settings.json":"~/.aar/settings.tmp.json",config:i})}catch(e){return console.error("IDE Save API error:",e),x.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function I(){await (0,f.getDatabase)();let e=await (0,C.getConfig)("port"),t=e?.value||"1357";return`http://localhost:${t}`}async function P(){await (0,f.getDatabase)();let e=await (0,C.getConfig)("api_key");return e?.value||"your-gateway-api-key"}e.s(["POST",()=>y],25785);var S=e.i(25785);let H=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/claude/save/route",pathname:"/api/ide/claude/save",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/claude/save/route.ts",nextConfigOutput:"",userland:S}),{workAsyncStorage:D,workUnitAsyncStorage:U,serverHooks:b}=H;function j(){return(0,a.patchFetch)({workAsyncStorage:D,workUnitAsyncStorage:U})}async function k(e,t,a){H.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/ide/claude/save/route";x=x.replace(/\/index$/,"")||"/";let A=await H.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!A)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:O,params:_,nextConfig:f,parsedUrl:C,isDraftMode:T,prerenderManifest:N,routerServerContext:m,isOnDemandRevalidate:w,revalidateOnlyGenerated:y,resolvedPathname:I,clientReferenceManifest:P,serverActionsManifest:S}=A,D=(0,o.normalizeAppPath)(x),U=!!(N.dynamicRoutes[D]||N.routes[I]),b=async()=>((null==m?void 0:m.render404)?await m.render404(e,t,C,!1):t.end("This page could not be found"),null);if(U&&!T){let e=!!N.routes[I],t=N.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(f.experimental.adapterPath)return await b();throw new E.NoFallbackError}}let j=null;!U||H.isDev||T||(j="/index"===(j=I)?"/":j);let k=!0===H.isDev||!U,L=U&&!k;S&&P&&(0,i.setManifestsSingleton)({page:x,clientReferenceManifest:P,serverActionsManifest:S});let M=e.method||"GET",q=(0,s.getTracer)(),F=q.getActiveScopeSpan(),K={params:_,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!f.experimental.authInterrupts},cacheComponents:!!f.cacheComponents,supportsDynamicResponse:k,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:f.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>H.onRequestError(e,t,a,n,m)},sharedContext:{buildId:O}},$=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest($,(0,d.signalFromNodeResponse)(t));try{let i=async e=>H.handle(G,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=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${x}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&w&&y&&!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(!U)return await (0,c.sendResponse)($,B,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,v.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[h.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>=h.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:g.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 H.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:w})},!1,m),t}},u=await H.handleResponse({req:e,nextConfig:f,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:w,revalidateOnlyGenerated:y,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!U)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==g.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",w?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),T&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let E=(0,v.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&U||E.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||E.get("Cache-Control")||E.set("Cache-Control",(0,R.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)($,B,new Response(u.value.body,{headers:E,status:u.value.status||200})),null};F?await l(F):await q.withPropagatedContext(e.headers,()=>q.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${x}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof E.NoFallbackError||await H.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:w})},!1,m),U)throw t;return await (0,c.sendResponse)($,B,new Response(null,{status:500})),null}}e.s(["handler",()=>k,"patchFetch",()=>j,"routeModule",()=>H,"serverHooks",()=>b,"workAsyncStorage",()=>D,"workUnitAsyncStorage",()=>U],56048)}];
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"))},56048,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),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),v=e.i(70101),g=e.i(26937),h=e.i(10372),R=e.i(93695);e.i(52474);var E=e.i(220),x=e.i(89171),f=e.i(22734),A=e.i(14747),O=e.i(46786),_=e.i(71560),C=e.i(97731);let m=(0,A.join)((0,O.homedir)(),".claude"),y=(0,A.join)(m,"settings.json"),N=(0,A.join)((0,O.homedir)(),".claude.json"),T=(0,A.join)((0,O.homedir)(),".aar"),S=(0,A.join)(T,"settings.tmp.json"),w=(0,A.join)(T,"backups");async function I(e){try{let n,s,i,{haiku:o,sonnet:l,opus:u,default:d,reasoning:c}=await e.json();if(void 0===o&&void 0===l&&void 0===u&&void 0===d&&void 0===c)return x.NextResponse.json({error:"No model settings provided"},{status:400});let p=await P(),v=await D(),g=(0,f.existsSync)(y),h=!1;if(g){let e=JSON.parse((0,f.readFileSync)(y,"utf-8")),t=e.env?.ANTHROPIC_BASE_URL,r=e.env?.ANTHROPIC_AUTH_TOKEN;h=t===p&&r===v}if(g&&h){var t,r,a;n=y,s="applied";let e=H(y,"settings"),g=H(N,"claude");e.success||console.warn("[IDE Save] Settings backup warning:",e.error),g.success||console.warn("[IDE Save] Claude.json backup warning:",g.error),t=p,r=v,a={haiku:o,sonnet:l,opus:u,default:d,reasoning:c},i={router_provider:"aar",env:{ANTHROPIC_AUTH_TOKEN:r,ANTHROPIC_BASE_URL:t,ANTHROPIC_DEFAULT_HAIKU_MODEL:a.haiku,ANTHROPIC_DEFAULT_OPUS_MODEL:a.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:a.sonnet,ANTHROPIC_MODEL:a.default,ANTHROPIC_REASONING_MODEL:a.reasoning,API_TIMEOUT_MS:"3000000",CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:1,hasCompletedOnboarding:!0}};let h=function(){try{let e={},t=!1;if((0,f.existsSync)(N))try{let t=(0,f.readFileSync)(N,"utf-8");e=JSON.parse(t)}catch{e={}}else t=!0;if(!0===e.hasCompletedOnboarding)return{success:!0,created:!1};return e.hasCompletedOnboarding=!0,(0,f.writeFileSync)(N,JSON.stringify(e,null,2),"utf-8"),{success:!0,created:t}}catch(e){return{success:!1,created:!1,error:`Failed to update claude.json: ${e.message}`}}}();h.success||console.warn("[IDE Save] Onboarding update warning:",h.error)}else n=S,s="temp",i={modelMapping:{haiku:o,sonnet:l,opus:u,default:d,reasoning:c},isTemp:!0,savedAt:new Date().toISOString()};let R=n===y?m:T;(0,f.existsSync)(R)||(0,f.mkdirSync)(R,{recursive:!0});let E=JSON.stringify(i,null,2);return(0,f.writeFileSync)(n,E,"utf-8"),console.log("[IDE Save] Configuration saved:",{saveType:s,savePath:n,isCurrentGatewayApplied:h,config:"temp"===s?i:{baseUrl:i.env?.ANTHROPIC_BASE_URL,hasApiKey:!!i.env?.ANTHROPIC_AUTH_TOKEN,modelMapping:{haiku:i.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,sonnet:i.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,opus:i.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,default:i.env?.ANTHROPIC_MODEL,reasoning:i.env?.ANTHROPIC_REASONING_MODEL}}}),x.NextResponse.json({success:!0,message:"applied"===s?"配置已更新到 Claude Code":"配置已保存(临时)",saveType:s,savePath:n===y?"~/.claude/settings.json":"~/.aar/settings.tmp.json",config:i})}catch(e){return console.error("IDE Save API error:",e),x.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function P(){await (0,_.getDatabase)();let e=await (0,C.getConfig)("port"),t=e?.value||"1357";return`http://localhost:${t}`}async function D(){await (0,_.getDatabase)();let e=await (0,C.getConfig)("api_key");return e?.value||"your-gateway-api-key"}function H(e,t){try{if(!(0,f.existsSync)(e))return{success:!0};(0,f.existsSync)(w)||(0,f.mkdirSync)(w,{recursive:!0});let r=new Date().toISOString().replace(/[:.]/g,"-"),a=(0,A.join)(w,`${t}-${r}.json`);return(0,f.copyFileSync)(e,a),{success:!0,backupPath:a}}catch(e){return{success:!1,error:`Backup to AAR failed: ${e.message}`}}}e.s(["POST",()=>I],25785);var b=e.i(25785);let j=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/claude/save/route",pathname:"/api/ide/claude/save",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/claude/save/route.ts",nextConfigOutput:"",userland:b}),{workAsyncStorage:U,workUnitAsyncStorage:k,serverHooks:L}=j;function M(){return(0,a.patchFetch)({workAsyncStorage:U,workUnitAsyncStorage:k})}async function F(e,t,a){j.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/ide/claude/save/route";x=x.replace(/\/index$/,"")||"/";let f=await j.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:A,params:O,nextConfig:_,parsedUrl:C,isDraftMode:m,prerenderManifest:y,routerServerContext:N,isOnDemandRevalidate:T,revalidateOnlyGenerated:S,resolvedPathname:w,clientReferenceManifest:I,serverActionsManifest:P}=f,D=(0,o.normalizeAppPath)(x),H=!!(y.dynamicRoutes[D]||y.routes[w]),b=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,C,!1):t.end("This page could not be found"),null);if(H&&!m){let e=!!y.routes[w],t=y.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(_.experimental.adapterPath)return await b();throw new R.NoFallbackError}}let U=null;!H||j.isDev||m||(U="/index"===(U=w)?"/":U);let k=!0===j.isDev||!H,L=H&&!k;P&&I&&(0,i.setManifestsSingleton)({page:x,clientReferenceManifest:I,serverActionsManifest:P});let M=e.method||"GET",F=(0,s.getTracer)(),q=F.getActiveScopeSpan(),K={params:O,prerenderManifest:y,renderOpts:{experimental:{authInterrupts:!!_.experimental.authInterrupts},cacheComponents:!!_.cacheComponents,supportsDynamicResponse:k,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:_.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>j.onRequestError(e,t,a,n,N)},sharedContext:{buildId:A}},$=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),G=u.NextRequestAdapter.fromNodeNextRequest($,(0,u.signalFromNodeResponse)(t));try{let i=async e=>j.handle(G,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.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=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${x}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let u=async({previousCacheEntry:r})=>{try{if(!o&&T&&S&&!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 u=K.renderOpts.collectedTags;if(!H)return await (0,p.sendResponse)($,B,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,v.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[h.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=h.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 j.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:T})},!1,N),t}},d=await j.handleResponse({req:e,nextConfig:_,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:S,responseGenerator:u,waitUntil:a.waitUntil,isMinimalMode:o});if(!H)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==E.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",T?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),m&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let R=(0,v.fromNodeOutgoingHttpHeaders)(d.value.headers);return o&&H||R.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||R.get("Cache-Control")||R.set("Cache-Control",(0,g.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)($,B,new Response(d.value.body,{headers:R,status:d.value.status||200})),null};q?await l(q):await F.withPropagatedContext(e.headers,()=>F.trace(d.BaseServerSpan.handleRequest,{spanName:`${M} ${x}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof R.NoFallbackError||await j.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:T})},!1,N),H)throw t;return await (0,p.sendResponse)($,B,new Response(null,{status:500})),null}}e.s(["handler",()=>F,"patchFetch",()=>M,"routeModule",()=>j,"serverHooks",()=>L,"workAsyncStorage",()=>U,"workUnitAsyncStorage",()=>k],56048)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__4a8f9bc7._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/app/api/ide/claude/save/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { getDatabase } from '@/db/database';\nimport { getConfig } from '@/db/queries';\n\n// Claude settings.json 文件路径\nconst CLAUDE_DIR = join(homedir(), '.claude');\nconst SETTINGS_FILE = join(CLAUDE_DIR, 'settings.json');\n\n// AAR 临时配置目录和文件\nconst AAR_DIR = join(homedir(), '.aar');\nconst TEMP_SETTINGS_FILE = join(AAR_DIR, 'settings.tmp.json');\n\ntype SaveRequest = {\n haiku?: string;\n sonnet?: string;\n opus?: string;\n default?: string;\n reasoning?: string;\n};\n\n/**\n * 保存 IDE 配置\n * - 如果当前已应用配置( ~/.claude/settings.json 存在且匹配当前网关),直接更新 settings.json\n * - 如果未应用网关配置,保存到 ~/.aar/settings.tmp.json(临时存储)\n */\nexport async function POST(request: NextRequest) {\n try {\n const body: SaveRequest = await request.json();\n const { haiku, sonnet, opus, default: defaultModel, reasoning: reasoningModel } = body;\n\n // 验证请求参数 - 至少需要一个设置\n if (haiku === undefined && sonnet === undefined && opus === undefined &&\n defaultModel === undefined && reasoningModel === undefined) {\n return NextResponse.json(\n { error: 'No model settings provided' },\n { status: 400 }\n );\n }\n\n // 获取当前网关地址和API Key(从数据库读取)\n const gatewayAddress = await getGatewayAddress();\n const gatewayApiKey = await getGatewayApiKey();\n\n // 检查当前配置状态\n const settingsFileExists = existsSync(SETTINGS_FILE);\n let isCurrentGatewayApplied = false;\n\n if (settingsFileExists) {\n const currentConfig = JSON.parse(readFileSync(SETTINGS_FILE, 'utf-8'));\n const appliedBaseUrl = currentConfig.env?.ANTHROPIC_BASE_URL;\n const appliedApiKey = currentConfig.env?.ANTHROPIC_AUTH_TOKEN;\n isCurrentGatewayApplied = appliedBaseUrl === gatewayAddress && appliedApiKey === gatewayApiKey;\n }\n\n // 决定保存位置和方式\n let savePath: string;\n let saveType: string;\n let mergedConfig: any;\n\n if (settingsFileExists && isCurrentGatewayApplied) {\n // 已应用当前网关配置,更新 settings.json\n savePath = SETTINGS_FILE;\n saveType = 'applied';\n mergedConfig = generateClaudeConfig(gatewayAddress, gatewayApiKey, {\n haiku: haiku,\n sonnet: sonnet,\n opus: opus,\n default: defaultModel,\n reasoning: reasoningModel\n });\n } else {\n // 未应用网络关配置,保存到临时文件 ~/.aar/settings.tmp.json\n savePath = TEMP_SETTINGS_FILE;\n saveType = 'temp';\n\n // 临时配置只保存模型映射,不包含网关信息\n mergedConfig = {\n modelMapping: {\n haiku: haiku,\n sonnet: sonnet,\n opus: opus,\n default: defaultModel,\n reasoning: reasoningModel,\n },\n // 标记这是临时配置,需要应用时才获取网关信息\n isTemp: true,\n savedAt: new Date().toISOString(),\n };\n }\n\n // 确保目录存在\n const targetDir = savePath === SETTINGS_FILE ? CLAUDE_DIR : AAR_DIR;\n if (!existsSync(targetDir)) {\n mkdirSync(targetDir, { recursive: true });\n }\n\n // 写入配置\n const jsonString = JSON.stringify(mergedConfig, null, 2);\n writeFileSync(savePath, jsonString, 'utf-8');\n\n console.log('[IDE Save] Configuration saved:', {\n saveType,\n savePath,\n isCurrentGatewayApplied,\n config: saveType === 'temp' ? mergedConfig : {\n baseUrl: mergedConfig.env?.ANTHROPIC_BASE_URL,\n hasApiKey: !!mergedConfig.env?.ANTHROPIC_AUTH_TOKEN,\n modelMapping: {\n haiku: mergedConfig.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,\n sonnet: mergedConfig.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,\n opus: mergedConfig.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,\n default: mergedConfig.env?.ANTHROPIC_MODEL,\n reasoning: mergedConfig.env?.ANTHROPIC_REASONING_MODEL,\n },\n },\n });\n\n return NextResponse.json({\n success: true,\n message: saveType === 'applied'\n ? '配置已更新到 Claude Code'\n : '配置已保存(临时)',\n saveType,\n savePath: savePath === SETTINGS_FILE ? '~/.claude/settings.json' : '~/.aar/settings.tmp.json',\n config: mergedConfig,\n });\n } catch (error: any) {\n console.error('IDE Save 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\n/**\n * 获取当前网关地址(从数据库读取)\n */\nasync function getGatewayAddress(): Promise<string> {\n await getDatabase();\n const portConfig = await getConfig('port');\n const port = portConfig?.value || '1357';\n return `http://localhost:${port}`;\n}\n\n/**\n * 获取当前网关 API Key(从数据库读取)\n */\nasync function getGatewayApiKey(): Promise<string> {\n await getDatabase();\n const apiKeyConfig = await getConfig('api_key');\n return apiKeyConfig?.value || 'your-gateway-api-key';\n}\n\n/**\n * 生成完整的 Claude 配置(用于更新 settings.json)\n */\nfunction generateClaudeConfig(\n gatewayAddress: string,\n gatewayApiKey: string,\n modelMapping: SaveRequest\n): any {\n return {\n router_provider: 'aar',\n env: {\n ANTHROPIC_AUTH_TOKEN: gatewayApiKey,\n ANTHROPIC_BASE_URL: gatewayAddress,\n ANTHROPIC_DEFAULT_HAIKU_MODEL: modelMapping.haiku,\n ANTHROPIC_DEFAULT_OPUS_MODEL: modelMapping.opus,\n ANTHROPIC_DEFAULT_SONNET_MODEL: modelMapping.sonnet,\n ANTHROPIC_MODEL: modelMapping.default,\n ANTHROPIC_REASONING_MODEL: modelMapping.reasoning,\n API_TIMEOUT_MS: '3000000',\n CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: 1,\n hasCompletedOnboarding: true,\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/ide/claude/save/route\",\n pathname: \"/api/ide/claude/save\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/ide/claude/save/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/claude/save/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,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAGA,IAAM,EAAa,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,WAC7B,EAAgB,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAY,iBAGjC,EAAU,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAO,AAAP,IAAW,QAC1B,EAAqB,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAS,qBAelC,eAAe,EAAK,CAAoB,EAC7C,GAAI,KAoIJ,MAlIE,IA2BI,EACA,E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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
+ {"version":3,"sources":["../../../src/app/api/ide/claude/save/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { getDatabase } from '@/db/database';\nimport { getConfig } from '@/db/queries';\n\n// Claude settings.json 文件路径\nconst CLAUDE_DIR = join(homedir(), '.claude');\nconst SETTINGS_FILE = join(CLAUDE_DIR, 'settings.json');\n\n// Claude 登录配置文件(用于 hasCompletedOnboarding)\nconst CLAUDE_JSON_FILE = join(homedir(), '.claude.json');\n\n// AAR 临时配置目录和文件\nconst AAR_DIR = join(homedir(), '.aar');\nconst TEMP_SETTINGS_FILE = join(AAR_DIR, 'settings.tmp.json');\n\n// AAR 备份目录\nconst AAR_BACKUP_DIR = join(AAR_DIR, 'backups');\n\ntype SaveRequest = {\n haiku?: string;\n sonnet?: string;\n opus?: string;\n default?: string;\n reasoning?: string;\n};\n\n/**\n * 保存 IDE 配置\n * - 如果当前已应用配置( ~/.claude/settings.json 存在且匹配当前网关),直接更新 settings.json\n * - 如果未应用网关配置,保存到 ~/.aar/settings.tmp.json(临时存储)\n */\nexport async function POST(request: NextRequest) {\n try {\n const body: SaveRequest = await request.json();\n const { haiku, sonnet, opus, default: defaultModel, reasoning: reasoningModel } = body;\n\n // 验证请求参数 - 至少需要一个设置\n if (haiku === undefined && sonnet === undefined && opus === undefined &&\n defaultModel === undefined && reasoningModel === undefined) {\n return NextResponse.json(\n { error: 'No model settings provided' },\n { status: 400 }\n );\n }\n\n // 获取当前网关地址和API Key(从数据库读取)\n const gatewayAddress = await getGatewayAddress();\n const gatewayApiKey = await getGatewayApiKey();\n\n // 检查当前配置状态\n const settingsFileExists = existsSync(SETTINGS_FILE);\n let isCurrentGatewayApplied = false;\n\n if (settingsFileExists) {\n const currentConfig = JSON.parse(readFileSync(SETTINGS_FILE, 'utf-8'));\n const appliedBaseUrl = currentConfig.env?.ANTHROPIC_BASE_URL;\n const appliedApiKey = currentConfig.env?.ANTHROPIC_AUTH_TOKEN;\n isCurrentGatewayApplied = appliedBaseUrl === gatewayAddress && appliedApiKey === gatewayApiKey;\n }\n\n // 决定保存位置和方式\n let savePath: string;\n let saveType: string;\n let mergedConfig: any;\n\n if (settingsFileExists && isCurrentGatewayApplied) {\n // 已应用当前网关配置,更新 settings.json\n savePath = SETTINGS_FILE;\n saveType = 'applied';\n \n // 备份到 ~/.aar/backups 目录\n const settingsBackup = backupToAar(SETTINGS_FILE, 'settings');\n const claudeJsonBackup = backupToAar(CLAUDE_JSON_FILE, 'claude');\n \n if (!settingsBackup.success) {\n console.warn('[IDE Save] Settings backup warning:', settingsBackup.error);\n }\n if (!claudeJsonBackup.success) {\n console.warn('[IDE Save] Claude.json backup warning:', claudeJsonBackup.error);\n }\n \n mergedConfig = generateClaudeConfig(gatewayAddress, gatewayApiKey, {\n haiku: haiku,\n sonnet: sonnet,\n opus: opus,\n default: defaultModel,\n reasoning: reasoningModel\n });\n \n // 确保 ~/.claude.json 包含 hasCompletedOnboarding: true\n const onboardingResult = ensureClaudeOnboarding();\n if (!onboardingResult.success) {\n console.warn('[IDE Save] Onboarding update warning:', onboardingResult.error);\n }\n } else {\n // 未应用网络关配置,保存到临时文件 ~/.aar/settings.tmp.json\n savePath = TEMP_SETTINGS_FILE;\n saveType = 'temp';\n\n // 临时配置只保存模型映射,不包含网关信息\n mergedConfig = {\n modelMapping: {\n haiku: haiku,\n sonnet: sonnet,\n opus: opus,\n default: defaultModel,\n reasoning: reasoningModel,\n },\n // 标记这是临时配置,需要应用时才获取网关信息\n isTemp: true,\n savedAt: new Date().toISOString(),\n };\n }\n\n // 确保目录存在\n const targetDir = savePath === SETTINGS_FILE ? CLAUDE_DIR : AAR_DIR;\n if (!existsSync(targetDir)) {\n mkdirSync(targetDir, { recursive: true });\n }\n\n // 写入配置\n const jsonString = JSON.stringify(mergedConfig, null, 2);\n writeFileSync(savePath, jsonString, 'utf-8');\n\n console.log('[IDE Save] Configuration saved:', {\n saveType,\n savePath,\n isCurrentGatewayApplied,\n config: saveType === 'temp' ? mergedConfig : {\n baseUrl: mergedConfig.env?.ANTHROPIC_BASE_URL,\n hasApiKey: !!mergedConfig.env?.ANTHROPIC_AUTH_TOKEN,\n modelMapping: {\n haiku: mergedConfig.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,\n sonnet: mergedConfig.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,\n opus: mergedConfig.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,\n default: mergedConfig.env?.ANTHROPIC_MODEL,\n reasoning: mergedConfig.env?.ANTHROPIC_REASONING_MODEL,\n },\n },\n });\n\n return NextResponse.json({\n success: true,\n message: saveType === 'applied'\n ? '配置已更新到 Claude Code'\n : '配置已保存(临时)',\n saveType,\n savePath: savePath === SETTINGS_FILE ? '~/.claude/settings.json' : '~/.aar/settings.tmp.json',\n config: mergedConfig,\n });\n } catch (error: any) {\n console.error('IDE Save 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\n/**\n * 获取当前网关地址(从数据库读取)\n */\nasync function getGatewayAddress(): Promise<string> {\n await getDatabase();\n const portConfig = await getConfig('port');\n const port = portConfig?.value || '1357';\n return `http://localhost:${port}`;\n}\n\n/**\n * 获取当前网关 API Key(从数据库读取)\n */\nasync function getGatewayApiKey(): Promise<string> {\n await getDatabase();\n const apiKeyConfig = await getConfig('api_key');\n return apiKeyConfig?.value || 'your-gateway-api-key';\n}\n\n/**\n * 生成完整的 Claude 配置(用于更新 settings.json)\n */\nfunction generateClaudeConfig(\n gatewayAddress: string,\n gatewayApiKey: string,\n modelMapping: SaveRequest\n): any {\n return {\n router_provider: 'aar',\n env: {\n ANTHROPIC_AUTH_TOKEN: gatewayApiKey,\n ANTHROPIC_BASE_URL: gatewayAddress,\n ANTHROPIC_DEFAULT_HAIKU_MODEL: modelMapping.haiku,\n ANTHROPIC_DEFAULT_OPUS_MODEL: modelMapping.opus,\n ANTHROPIC_DEFAULT_SONNET_MODEL: modelMapping.sonnet,\n ANTHROPIC_MODEL: modelMapping.default,\n ANTHROPIC_REASONING_MODEL: modelMapping.reasoning,\n API_TIMEOUT_MS: '3000000',\n CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: 1,\n hasCompletedOnboarding: true,\n },\n };\n}\n\n/**\n * 备份文件到 ~/.aar/backups 目录\n */\nfunction backupToAar(filePath: string, backupName: string): { success: boolean; backupPath?: string; error?: string } {\n try {\n if (!existsSync(filePath)) {\n return { success: true }; // 文件不存在,无需备份\n }\n \n if (!existsSync(AAR_BACKUP_DIR)) {\n mkdirSync(AAR_BACKUP_DIR, { recursive: true });\n }\n \n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n const backupPath = join(AAR_BACKUP_DIR, `${backupName}-${timestamp}.json`);\n copyFileSync(filePath, backupPath);\n \n return { success: true, backupPath };\n } catch (error: any) {\n return {\n success: false,\n error: `Backup to AAR failed: ${error.message}`,\n };\n }\n}\n\n/**\n * 确保 ~/.claude.json 文件中包含 hasCompletedOnboarding: true\n * 这允许用户跳过 Claude 登录使用自定义模型\n */\nfunction ensureClaudeOnboarding(): { success: boolean; created: boolean; error?: string } {\n try {\n let config: any = {};\n let created = false;\n \n if (existsSync(CLAUDE_JSON_FILE)) {\n try {\n const content = readFileSync(CLAUDE_JSON_FILE, 'utf-8');\n config = JSON.parse(content);\n } catch {\n // 文件存在但解析失败,使用空对象\n config = {};\n }\n } else {\n created = true;\n }\n \n // 检查是否已经有 hasCompletedOnboarding\n if (config.hasCompletedOnboarding === true) {\n return { success: true, created: false };\n }\n \n // 添加 hasCompletedOnboarding\n config.hasCompletedOnboarding = true;\n writeFileSync(CLAUDE_JSON_FILE, JSON.stringify(config, null, 2), 'utf-8');\n \n return { success: true, created };\n } catch (error: any) {\n return {\n success: false,\n created: false,\n error: `Failed to update claude.json: ${error.message}`,\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/ide/claude/save/route\",\n pathname: \"/api/ide/claude/save\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/ide/claude/save/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/claude/save/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,EAA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BAAiB,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]}
@@ -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"))},51532,e=>{"use strict";var t=e.i(71560),r=e.i(97731);async function a(){await (0,t.getDatabase)();let e=await (0,r.getConfig)("port"),a=e?.value||"1357";return`http://localhost:${a}/v1`}async function n(){await (0,t.getDatabase)();let e=await (0,r.getConfig)("api_key");return e?.value||"your-gateway-api-key"}async function o(){let e=await a(),t=await n(),o=(await (0,r.getAllModels)()).filter(e=>e.enabled),i={};for(let e of o)await (0,r.getProviderById)(e.provider_id),i[e.model_id]={name:e.name,limit:{context:128e3,output:65536}};return{npm:"@ai-sdk/openai-compatible",name:"AAR Model Router",options:{baseURL:e,apiKey:t},models:i}}let i="aar-gateway";async function s(e,t){let r,a,n=await o();return(a=(r=t&&"object"==typeof t?{...t}:{}).provider&&"object"==typeof r.provider?{...r.provider}:{})[i]=n,{...r,provider:a,model:`${i}/${e}`}}e.s(["buildMergedConfig",()=>s])},63218,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),o=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),d=e.i(87718),p=e.i(95169),u=e.i(47587),c=e.i(66012),f=e.i(70101),g=e.i(26937),v=e.i(10372),h=e.i(93695);e.i(52474);var x=e.i(220),y=e.i(89171),R=e.i(22734),m=e.i(14747),w=e.i(46786),C=e.i(71560),b=e.i(97731),E=e.i(51532);let j=(0,m.join)((0,w.homedir)(),".config","opencode"),S=(0,m.join)(j,"opencode.json"),N=(0,m.join)(j,"opencode.json.aar.bak"),A=(0,m.join)((0,w.homedir)(),".aar"),k=(0,m.join)(A,"opencode.tmp.json");async function O(){await (0,C.getDatabase)();let e=await (0,b.getConfig)("port");return`http://localhost:${e?.value||"1357"}/v1`}async function P(){await (0,C.getDatabase)();let e=await (0,b.getConfig)("api_key");return e?.value||"your-gateway-api-key"}async function T(e){try{let t,r,a,{default_model:n,config:o}=await e.json();if("string"==typeof o&&o.trim()){let e;try{if(!(e=JSON.parse(o))||"object"!=typeof e)throw Error("Invalid config object")}catch(e){return y.NextResponse.json({error:"Invalid config JSON: "+(e.message||"parse error")},{status:400})}let t=function(){try{if((0,R.existsSync)(S)){let e=(0,R.readFileSync)(S,"utf-8");(0,R.writeFileSync)(N,e,"utf-8")}return{success:!0}}catch(e){return{success:!1,error:`Backup failed: ${e.message}`}}}();if(!t.success)return y.NextResponse.json({error:t.error},{status:500});return(0,R.existsSync)(j)||(0,R.mkdirSync)(j,{recursive:!0}),(0,R.writeFileSync)(S,JSON.stringify(e,null,2),"utf-8"),y.NextResponse.json({success:!0,message:"配置已更新到 OpenCode",saveType:"applied",savePath:"~/.config/opencode/opencode.json",config:e})}if(void 0===n||""===n)return y.NextResponse.json({error:"No default model provided"},{status:400});let i=await O(),s=await P(),l=(0,R.existsSync)(S),d=null;if(l)try{d=JSON.parse((0,R.readFileSync)(S,"utf-8"))}catch{d=null}let p=d?.provider?.["aar-gateway"],u=!!p&&p?.options?.baseURL===i&&p?.options?.apiKey===s;l&&u&&d?(a=await (0,E.buildMergedConfig)(n,d),t=S,r="applied"):(t=k,r="temp",a={defaultModel:n,isTemp:!0,savedAt:new Date().toISOString()});let c=t===S?j:A;return(0,R.existsSync)(c)||(0,R.mkdirSync)(c,{recursive:!0}),(0,R.writeFileSync)(t,JSON.stringify(a,null,2),"utf-8"),y.NextResponse.json({success:!0,message:"applied"===r?"配置已更新到 OpenCode":"配置已保存(临时)",saveType:r,savePath:t===S?"~/.config/opencode/opencode.json":"~/.aar/opencode.tmp.json",config:a})}catch(e){return console.error("OpenCode Save API error:",e),y.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}e.s(["POST",()=>T],74679);var _=e.i(74679);let q=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/opencode/save/route",pathname:"/api/ide/opencode/save",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/opencode/save/route.ts",nextConfigOutput:"",userland:_}),{workAsyncStorage:I,workUnitAsyncStorage:D,serverHooks:U}=q;function H(){return(0,a.patchFetch)({workAsyncStorage:I,workUnitAsyncStorage:D})}async function M(e,t,a){q.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/ide/opencode/save/route";y=y.replace(/\/index$/,"")||"/";let R=await q.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:m,params:w,nextConfig:C,parsedUrl:b,isDraftMode:E,prerenderManifest:j,routerServerContext:S,isOnDemandRevalidate:N,revalidateOnlyGenerated:A,resolvedPathname:k,clientReferenceManifest:O,serverActionsManifest:P}=R,T=(0,s.normalizeAppPath)(y),_=!!(j.dynamicRoutes[T]||j.routes[k]),I=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,b,!1):t.end("This page could not be found"),null);if(_&&!E){let e=!!j.routes[k],t=j.dynamicRoutes[T];if(t&&!1===t.fallback&&!e){if(C.experimental.adapterPath)return await I();throw new h.NoFallbackError}}let D=null;!_||q.isDev||E||(D="/index"===(D=k)?"/":D);let U=!0===q.isDev||!_,H=_&&!U;P&&O&&(0,i.setManifestsSingleton)({page:y,clientReferenceManifest:O,serverActionsManifest:P});let M=e.method||"GET",$=(0,o.getTracer)(),F=$.getActiveScopeSpan(),K={params:w,prerenderManifest:j,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:C.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>q.onRequestError(e,t,a,n,S)},sharedContext:{buildId:m}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),J=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let i=async e=>q.handle(J,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")!==p.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=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${y}`)}),s=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var o,l;let d=async({previousCacheEntry:r})=>{try{if(!s&&N&&A&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=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(!_)return await (0,c.sendResponse)(B,L,o,K.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[v.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>=v.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await q.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:N})},!1,S),t}},p=await q.handleResponse({req:e,nextConfig:C,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:A,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:s});if(!_)return null;if((null==p||null==(o=p.value)?void 0:o.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(l=p.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});s||t.setHeader("x-nextjs-cache",N?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),E&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,f.fromNodeOutgoingHttpHeaders)(p.value.headers);return s&&_||h.delete(v.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,g.getCacheControlHeader)(p.cacheControl)),await (0,c.sendResponse)(B,L,new Response(p.value.body,{headers:h,status:p.value.status||200})),null};F?await l(F):await $.withPropagatedContext(e.headers,()=>$.trace(p.BaseServerSpan.handleRequest,{spanName:`${M} ${y}`,kind:o.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof h.NoFallbackError||await q.onRequestError(e,t,{routerKind:"App Router",routePath:T,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:N})},!1,S),_)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>M,"patchFetch",()=>H,"routeModule",()=>q,"serverHooks",()=>U,"workAsyncStorage",()=>I,"workUnitAsyncStorage",()=>D],63218)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__55cd88b8._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/app/api/ide/opencode/build-config.ts","../../../src/app/api/ide/opencode/save/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { getDatabase } from '@/db/database';\nimport { getConfig } from '@/db/queries';\nimport { getAllModels, getProviderById } from '@/db/queries';\n\nexport async function getGatewayAddress(): Promise<string> {\n await getDatabase();\n const portConfig = await getConfig('port');\n const port = portConfig?.value || '1357';\n return `http://localhost:${port}/v1`;\n}\n\nexport async function getGatewayApiKey(): Promise<string> {\n await getDatabase();\n const apiKeyConfig = await getConfig('api_key');\n return apiKeyConfig?.value || 'your-gateway-api-key';\n}\n\n/** OpenCode provider 下单个 provider 的结构(与官方 provider 文档一致) */\nexport type AarGatewayProviderEntry = {\n npm: string;\n name: string;\n options: { baseURL: string; apiKey: string };\n models: Record<string, { name: string; limit?: { context: number; output?: number } }>;\n};\n\nexport async function buildAarGatewayProvider(): Promise<AarGatewayProviderEntry> {\n const gatewayAddress = await getGatewayAddress();\n const gatewayApiKey = await getGatewayApiKey();\n const allModels = (await getAllModels()).filter((m: any) => m.enabled);\n const models: Record<string, { name: string; limit: { context: number; output: number } }> = {};\n for (const m of allModels) {\n await getProviderById(m.provider_id);\n models[m.model_id] = { name: m.name, limit: { context: 128000, output: 65536 } };\n }\n return {\n npm: '@ai-sdk/openai-compatible',\n name: 'AAR Model Router',\n options: { baseURL: gatewayAddress, apiKey: gatewayApiKey },\n models,\n };\n}\n\nconst AAR_PROVIDER_ID = 'aar-gateway';\n\n/** 合并现有配置与 AAR 网关:写入 config.provider[\"aar-gateway\"],并设置 config.model = \"aar-gateway/{defaultModel}\" */\nexport function mergeConfigWithAar(\n existing: Record<string, any> | null,\n defaultModel: string,\n aarProvider: AarGatewayProviderEntry\n): Record<string, any> {\n const base = existing && typeof existing === 'object' ? { ...existing } : {};\n const provider: Record<string, any> =\n base.provider && typeof base.provider === 'object' ? { ...base.provider } : {};\n provider[AAR_PROVIDER_ID] = aarProvider;\n return {\n ...base,\n provider,\n model: `${AAR_PROVIDER_ID}/${defaultModel}`,\n };\n}\n\n/** 生成合并后的配置(不写入磁盘),供预览或应用使用 */\nexport async function buildMergedConfig(\n defaultModel: string,\n existing: Record<string, any> | null\n): Promise<Record<string, any>> {\n const aarProvider = await buildAarGatewayProvider();\n return mergeConfigWithAar(existing, defaultModel, aarProvider);\n}\n","import { NextRequest, NextResponse } from 'next/server';\nimport { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { getDatabase } from '@/db/database';\nimport { getConfig } from '@/db/queries';\nimport { buildMergedConfig } from '../build-config';\n\nconst OPENCODE_DIR =\n process.platform === 'win32'\n ? join(process.env.APPDATA || homedir(), 'opencode')\n : join(homedir(), '.config', 'opencode');\nconst OPENCODE_FILE = join(OPENCODE_DIR, 'opencode.json');\nconst BACKUP_FILE = join(OPENCODE_DIR, 'opencode.json.aar.bak');\nconst AAR_DIR = join(homedir(), '.aar');\nconst TEMP_OPENCODE_FILE = join(AAR_DIR, 'opencode.tmp.json');\n\nfunction backupIfExists(): { success: boolean; error?: string } {\n try {\n if (existsSync(OPENCODE_FILE)) {\n const original = readFileSync(OPENCODE_FILE, 'utf-8');\n writeFileSync(BACKUP_FILE, original, 'utf-8');\n }\n return { success: true };\n } catch (error: any) {\n return { success: false, error: `Backup failed: ${error.message}` };\n }\n}\n\nasync function getGatewayAddress(): Promise<string> {\n await getDatabase();\n const portConfig = await getConfig('port');\n return `http://localhost:${portConfig?.value || '1357'}/v1`;\n}\n\nasync function getGatewayApiKey(): Promise<string> {\n await getDatabase();\n const apiKeyConfig = await getConfig('api_key');\n return apiKeyConfig?.value || 'your-gateway-api-key';\n}\n\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json();\n const { default_model: defaultModel, config: customConfigStr } = body;\n\n // 若前端传了编辑后的 config,直接写入 opencode.json(与「应用配置」一致)\n if (typeof customConfigStr === 'string' && customConfigStr.trim()) {\n let config: Record<string, any>;\n try {\n config = JSON.parse(customConfigStr);\n if (!config || typeof config !== 'object') throw new Error('Invalid config object');\n } catch (e: any) {\n return NextResponse.json({ error: 'Invalid config JSON: ' + (e.message || 'parse error') }, { status: 400 });\n }\n const backupResult = backupIfExists();\n if (!backupResult.success) {\n return NextResponse.json({ error: backupResult.error }, { status: 500 });\n }\n if (!existsSync(OPENCODE_DIR)) mkdirSync(OPENCODE_DIR, { recursive: true });\n writeFileSync(OPENCODE_FILE, JSON.stringify(config, null, 2), 'utf-8');\n return NextResponse.json({\n success: true,\n message: '配置已更新到 OpenCode',\n saveType: 'applied',\n savePath: '~/.config/opencode/opencode.json',\n config,\n });\n }\n\n if (defaultModel === undefined || defaultModel === '') {\n return NextResponse.json({ error: 'No default model provided' }, { status: 400 });\n }\n\n const gatewayAddress = await getGatewayAddress();\n const gatewayApiKey = await getGatewayApiKey();\n\n const fileExists = existsSync(OPENCODE_FILE);\n let current: Record<string, any> | null = null;\n if (fileExists) {\n try {\n current = JSON.parse(readFileSync(OPENCODE_FILE, 'utf-8'));\n } catch {\n current = null;\n }\n }\n const aar = current?.provider?.['aar-gateway'];\n const isCurrentGatewayApplied =\n !!aar &&\n aar?.options?.baseURL === gatewayAddress &&\n aar?.options?.apiKey === gatewayApiKey;\n\n let savePath: string;\n let saveType: string;\n let mergedConfig: any;\n\n if (fileExists && isCurrentGatewayApplied && current) {\n mergedConfig = await buildMergedConfig(defaultModel, current);\n savePath = OPENCODE_FILE;\n saveType = 'applied';\n } else {\n savePath = TEMP_OPENCODE_FILE;\n saveType = 'temp';\n mergedConfig = {\n defaultModel,\n isTemp: true,\n savedAt: new Date().toISOString(),\n };\n }\n\n const targetDir = savePath === OPENCODE_FILE ? OPENCODE_DIR : AAR_DIR;\n if (!existsSync(targetDir)) {\n mkdirSync(targetDir, { recursive: true });\n }\n writeFileSync(savePath, JSON.stringify(mergedConfig, null, 2), 'utf-8');\n\n return NextResponse.json({\n success: true,\n message: saveType === 'applied' ? '配置已更新到 OpenCode' : '配置已保存(临时)',\n saveType,\n savePath: savePath === OPENCODE_FILE ? '~/.config/opencode/opencode.json' : '~/.aar/opencode.tmp.json',\n config: mergedConfig,\n });\n } catch (error: any) {\n console.error('OpenCode Save 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/ide/opencode/save/route\",\n pathname: \"/api/ide/opencode/save\",\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/save/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/save/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":"8iCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAGO,eAAe,IACpB,MAAM,CAAA,EAAA,EAAA,WAAA,AAAW,IACjB,IAAM,EAAa,MAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,QAC7B,EAAO,GAAY,OAAS,OAClC,MAAO,CAAC,iBAAiB,EAAE,EAAK,GAAG,CAAC,AACtC,CAEO,eAAe,IACpB,MAAM,CAAA,EAAA,EAAA,WAAA,AAAW,IACjB,IAAM,EAAe,MAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,WACrC,OAAO,GAAc,OAAS,sBAChC,CAUO,eAAe,IACpB,IAAM,EAAiB,MAAM,IACvB,EAAgB,MAAM,IACtB,EAAY,CAAC,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,GAAA,CAAE,CAAE,MAAM,CAAE,AAAD,GAAY,EAAE,OAAO,EAC/D,EAAuF,CAAC,EAC9F,IAAK,IAAM,KAAK,EACd,MAAM,CAAA,CADmB,CACnB,EAAA,eAAA,AAAe,EAAC,EAAE,WAAW,EACnC,CAAM,CAAC,EAAE,QAAQ,CAAC,CAAG,CAAE,KAAM,EAAE,IAAI,CAAE,MAAO,CAAE,QAAS,MAAQ,OAAQ,KAAM,CAAE,EAEjF,MAAO,CACL,IAAK,4BACL,KAAM,mBACN,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1B,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":[2]}
@@ -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"))},26994,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),u=e.i(87718),d=e.i(95169),p=e.i(47587),c=e.i(66012),x=e.i(70101),h=e.i(26937),R=e.i(10372),f=e.i(93695);e.i(52474);var g=e.i(220),v=e.i(89171),E=e.i(22734),y=e.i(14747),A=e.i(46786),m=e.i(71560),w=e.i(97731);let C=(0,y.join)((0,A.homedir)(),".claude"),N=(0,y.join)(C,"settings.json"),O=(0,y.join)(C,"settings.json.aar.bak");async function _(e){try{var t,r,a;let{haiku:n,sonnet:s,opus:i,default:o,reasoning:l}=await e.json();if(void 0===n||void 0===s||void 0===i||void 0===o||void 0===l)return v.NextResponse.json({error:"Missing required fields: haiku, sonnet, opus, default, reasoning"},{status:400});let u=await T(),d=await S(),p=(t=u,r=d,a={haiku:n,sonnet:s,opus:i,default:o,reasoning:l},{router_provider:"aar",env:{ANTHROPIC_AUTH_TOKEN:r,ANTHROPIC_BASE_URL:t,ANTHROPIC_DEFAULT_HAIKU_MODEL:a.haiku,ANTHROPIC_DEFAULT_OPUS_MODEL:a.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:a.sonnet,ANTHROPIC_MODEL:a.default,ANTHROPIC_REASONING_MODEL:a.reasoning,API_TIMEOUT_MS:"3000000",CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:1,hasCompletedOnboarding:!0}}),c=function(){try{if((0,E.existsSync)(N)){let e=(0,E.readFileSync)(N,"utf-8"),t=!1;try{let r=JSON.parse(e);t="aar"===r.router_provider}catch(e){t=!1}return(0,E.writeFileSync)(O,e,"utf-8"),{success:!0,existed:!0,isFromAar:t}}return{success:!0,existed:!1,isFromAar:!1}}catch(e){return{success:!1,existed:!1,isFromAar:!1,error:`Backup failed: ${e.message}`}}}();if(!c.success)return v.NextResponse.json({error:c.error},{status:500});(0,E.existsSync)(C)||(0,E.mkdirSync)(C,{recursive:!0});let x=function(e){try{let t=JSON.stringify(e,null,2);return JSON.parse(t),(0,E.writeFileSync)(N,t,"utf-8"),{success:!0}}catch(e){return{success:!1,error:`Validation or write failed: ${e.message}`}}}(p);if(!x.success)return v.NextResponse.json({error:x.error},{status:500});return v.NextResponse.json({success:!0,message:"Configuration applied successfully",config:p,backup:c.existed?"Created backup":"No existing config to backup",previousWasFromAar:c.existed&&c.isFromAar})}catch(e){return console.error("IDE Apply API error:",e),v.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function T(){await (0,m.getDatabase)();let e=await (0,w.getConfig)("port"),t=e?.value||"1357";return`http://localhost:${t}`}async function S(){await (0,m.getDatabase)();let e=await (0,w.getConfig)("api_key");return e?.value||"your-gateway-api-key"}e.s(["POST",()=>_],8245);var b=e.i(8245);let P=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/claude/apply/route",pathname:"/api/ide/claude/apply",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/claude/apply/route.ts",nextConfigOutput:"",userland:b}),{workAsyncStorage:k,workUnitAsyncStorage:I,serverHooks:j}=P;function D(){return(0,a.patchFetch)({workAsyncStorage:k,workUnitAsyncStorage:I})}async function H(e,t,a){P.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/ide/claude/apply/route";v=v.replace(/\/index$/,"")||"/";let E=await P.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!E)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,params:A,nextConfig:m,parsedUrl:w,isDraftMode:C,prerenderManifest:N,routerServerContext:O,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,resolvedPathname:S,clientReferenceManifest:b,serverActionsManifest:k}=E,I=(0,o.normalizeAppPath)(v),j=!!(N.dynamicRoutes[I]||N.routes[S]),D=async()=>((null==O?void 0:O.render404)?await O.render404(e,t,w,!1):t.end("This page could not be found"),null);if(j&&!C){let e=!!N.routes[S],t=N.dynamicRoutes[I];if(t&&!1===t.fallback&&!e){if(m.experimental.adapterPath)return await D();throw new f.NoFallbackError}}let H=null;!j||P.isDev||C||(H="/index"===(H=S)?"/":H);let U=!0===P.isDev||!j,q=j&&!U;k&&b&&(0,i.setManifestsSingleton)({page:v,clientReferenceManifest:b,serverActionsManifest:k});let F=e.method||"GET",M=(0,s.getTracer)(),L=M.getActiveScopeSpan(),$={params:A,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!m.experimental.authInterrupts},cacheComponents:!!m.cacheComponents,supportsDynamicResponse:U,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)=>P.onRequestError(e,t,a,n,O)},sharedContext:{buildId:y}},K=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),G=u.NextRequestAdapter.fromNodeNextRequest(K,(0,u.signalFromNodeResponse)(t));try{let i=async e=>P.handle(G,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.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=`${F} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${F} ${v}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let u=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=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let u=$.renderOpts.collectedTags;if(!j)return await (0,c.sendResponse)(K,B,s,$.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[R.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,a=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:g.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 P.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:q,isOnDemandRevalidate:_})},!1,O),t}},d=await P.handleResponse({req:e,nextConfig:m,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:_,revalidateOnlyGenerated:T,responseGenerator:u,waitUntil:a.waitUntil,isMinimalMode:o});if(!j)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",_?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,x.fromNodeOutgoingHttpHeaders)(d.value.headers);return o&&j||f.delete(R.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(K,B,new Response(d.value.body,{headers:f,status:d.value.status||200})),null};L?await l(L):await M.withPropagatedContext(e.headers,()=>M.trace(d.BaseServerSpan.handleRequest,{spanName:`${F} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},l))}catch(t){if(t instanceof f.NoFallbackError||await P.onRequestError(e,t,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:q,isOnDemandRevalidate:_})},!1,O),j)throw t;return await (0,c.sendResponse)(K,B,new Response(null,{status:500})),null}}e.s(["handler",()=>H,"patchFetch",()=>D,"routeModule",()=>P,"serverHooks",()=>j,"workAsyncStorage",()=>k,"workUnitAsyncStorage",()=>I],26994)}];
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"))},26994,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),u=e.i(87718),c=e.i(95169),d=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),R=e.i(89171),v=e.i(22734),m=e.i(14747),E=e.i(46786),w=e.i(71560),A=e.i(97731);let C=(0,m.join)((0,E.homedir)(),".claude"),O=(0,m.join)(C,"settings.json"),S=(0,m.join)(C,"settings.json.aar.bak"),N=(0,m.join)((0,E.homedir)(),".claude.json"),_=(0,m.join)((0,E.homedir)(),".aar","backups");async function b(e){try{let t,{haiku:r,sonnet:a,opus:n,default:s,reasoning:i}=await e.json();if(void 0===r||void 0===a||void 0===n||void 0===s||void 0===i)return R.NextResponse.json({error:"Missing required fields: haiku, sonnet, opus, default, reasoning"},{status:400});let o=await T(),l=await k(),u={haiku:r,sonnet:a,opus:n,default:s,reasoning:i},c=j(o,l,u),d=I(O,"settings"),p=I(N,"claude");d.success||console.warn("[Claude Apply] Settings backup warning:",d.error),p.success||console.warn("[Claude Apply] Claude.json backup warning:",p.error);let h=function(){try{if((0,v.existsSync)(O)){let e=(0,v.readFileSync)(O,"utf-8"),t=!1;try{let r=JSON.parse(e);t="aar"===r.router_provider}catch{t=!1}return t||(0,v.writeFileSync)(S,e,"utf-8"),{success:!0,existed:!0,isFromAar:t}}return{success:!0,existed:!1,isFromAar:!1}}catch(e){return{success:!1,existed:!1,isFromAar:!1,error:`Backup failed: ${e.message}`}}}();if(!h.success)return R.NextResponse.json({error:h.error},{status:500});if((0,v.existsSync)(C)||(0,v.mkdirSync)(C,{recursive:!0}),(0,v.existsSync)(O))try{let e=JSON.parse((0,v.readFileSync)(O,"utf-8"));t={...e,env:{...e.env||{},...c},router_provider:"aar"}}catch{t=P(o,l,u)}else t=P(o,l,u);let g=function(e){try{let t=JSON.stringify(e,null,2);return JSON.parse(t),(0,v.writeFileSync)(O,t,"utf-8"),{success:!0}}catch(e){return{success:!1,error:`Validation or write failed: ${e.message}`}}}(t);if(!g.success)return R.NextResponse.json({error:g.error},{status:500});let x=function(){try{let e={},t=!1;if((0,v.existsSync)(N))try{let t=(0,v.readFileSync)(N,"utf-8");e=JSON.parse(t)}catch{e={}}else t=!0;if(!0===e.hasCompletedOnboarding)return{success:!0,created:!1};return e.hasCompletedOnboarding=!0,(0,v.writeFileSync)(N,JSON.stringify(e,null,2),"utf-8"),{success:!0,created:t}}catch(e){return{success:!1,created:!1,error:`Failed to update claude.json: ${e.message}`}}}();return x.success||console.warn("[Claude Apply] Onboarding update warning:",x.error),R.NextResponse.json({success:!0,message:"Configuration applied successfully",config:t,backup:h.existed?"Created backup":"No existing config to backup",previousWasFromAar:h.existed&&h.isFromAar,onboarding:x.created?"Created ~/.claude.json":"Updated ~/.claude.json",aarBackups:{settings:d.backupPath,claudeJson:p.backupPath}})}catch(e){return console.error("IDE Apply API error:",e),R.NextResponse.json({error:e.message||"Internal server error",stack:void 0},{status:500})}}async function T(){await (0,w.getDatabase)();let e=await (0,A.getConfig)("port"),t=e?.value||"1357";return`http://localhost:${t}`}async function k(){await (0,w.getDatabase)();let e=await (0,A.getConfig)("api_key");return e?.value||"your-gateway-api-key"}function j(e,t,r){return{ANTHROPIC_AUTH_TOKEN:t,ANTHROPIC_BASE_URL:e,ANTHROPIC_DEFAULT_HAIKU_MODEL:r.haiku,ANTHROPIC_DEFAULT_OPUS_MODEL:r.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:r.sonnet,ANTHROPIC_MODEL:r.default,ANTHROPIC_REASONING_MODEL:r.reasoning,API_TIMEOUT_MS:"3000000",CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:1,hasCompletedOnboarding:!0}}function P(e,t,r){return{router_provider:"aar",env:j(e,t,r)}}function I(e,t){try{if(!(0,v.existsSync)(e))return{success:!0};(0,v.existsSync)(_)||(0,v.mkdirSync)(_,{recursive:!0});let r=new Date().toISOString().replace(/[:.]/g,"-"),a=(0,m.join)(_,`${t}-${r}.json`);return(0,v.copyFileSync)(e,a),{success:!0,backupPath:a}}catch(e){return{success:!1,error:`Backup to AAR failed: ${e.message}`}}}e.s(["POST",()=>b],8245);var D=e.i(8245);let H=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/ide/claude/apply/route",pathname:"/api/ide/claude/apply",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/ide/claude/apply/route.ts",nextConfigOutput:"",userland:D}),{workAsyncStorage:U,workUnitAsyncStorage:F,serverHooks:q}=H;function M(){return(0,a.patchFetch)({workAsyncStorage:U,workUnitAsyncStorage:F})}async function L(e,t,a){H.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let R="/api/ide/claude/apply/route";R=R.replace(/\/index$/,"")||"/";let v=await H.prepare(e,t,{srcPage:R,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:m,params:E,nextConfig:w,parsedUrl:A,isDraftMode:C,prerenderManifest:O,routerServerContext:S,isOnDemandRevalidate:N,revalidateOnlyGenerated:_,resolvedPathname:b,clientReferenceManifest:T,serverActionsManifest:k}=v,j=(0,o.normalizeAppPath)(R),P=!!(O.dynamicRoutes[j]||O.routes[b]),I=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,A,!1):t.end("This page could not be found"),null);if(P&&!C){let e=!!O.routes[b],t=O.dynamicRoutes[j];if(t&&!1===t.fallback&&!e){if(w.experimental.adapterPath)return await I();throw new f.NoFallbackError}}let D=null;!P||H.isDev||C||(D="/index"===(D=b)?"/":D);let U=!0===H.isDev||!P,F=P&&!U;k&&T&&(0,i.setManifestsSingleton)({page:R,clientReferenceManifest:T,serverActionsManifest:k});let q=e.method||"GET",M=(0,s.getTracer)(),L=M.getActiveScopeSpan(),$={params:E,prerenderManifest:O,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:w.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>H.onRequestError(e,t,a,n,S)},sharedContext:{buildId:m}},B=new l.NodeNextRequest(e),K=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let i=async e=>H.handle(J,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==c.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=`${q} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${q} ${R}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let u=async({previousCacheEntry:r})=>{try{if(!o&&N&&_&&!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=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let u=$.renderOpts.collectedTags;if(!P)return await (0,p.sendResponse)(B,K,s,$.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[x.NEXT_CACHE_TAGS_HEADER]=u),!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: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 H.onRequestError(e,t,{routerKind:"App Router",routePath:R,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,S),t}},c=await H.handleResponse({req:e,nextConfig:w,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:_,responseGenerator:u,waitUntil:a.waitUntil,isMinimalMode:o});if(!P)return null;if((null==c||null==(s=c.value)?void 0:s.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(l=c.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",N?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,h.fromNodeOutgoingHttpHeaders)(c.value.headers);return o&&P||f.delete(x.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,g.getCacheControlHeader)(c.cacheControl)),await (0,p.sendResponse)(B,K,new Response(c.value.body,{headers:f,status:c.value.status||200})),null};L?await l(L):await M.withPropagatedContext(e.headers,()=>M.trace(c.BaseServerSpan.handleRequest,{spanName:`${q} ${R}`,kind:s.SpanKind.SERVER,attributes:{"http.method":q,"http.target":e.url}},l))}catch(t){if(t instanceof f.NoFallbackError||await H.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,S),P)throw t;return await (0,p.sendResponse)(B,K,new Response(null,{status:500})),null}}e.s(["handler",()=>L,"patchFetch",()=>M,"routeModule",()=>H,"serverHooks",()=>q,"workAsyncStorage",()=>U,"workUnitAsyncStorage",()=>F],26994)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__5e8276bc._.js.map