vibepulse 0.1.12 → 0.2.0

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 (336) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +4 -0
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/cache/.previewinfo +1 -1
  5. package/.next/cache/.rscinfo +1 -1
  6. package/.next/cache/.tsbuildinfo +1 -1
  7. package/.next/cache/config.json +3 -3
  8. package/.next/fallback-build-manifest.json +2 -2
  9. package/.next/prerender-manifest.json +3 -3
  10. package/.next/routes-manifest.json +24 -0
  11. package/.next/server/app/_global-error/page.js +1 -1
  12. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  13. package/.next/server/app/_global-error.html +2 -2
  14. package/.next/server/app/_global-error.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/.next/server/app/_not-found/page.js +1 -1
  21. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/_not-found.html +1 -1
  24. package/.next/server/app/_not-found.rsc +2 -2
  25. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  26. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  28. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  29. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  30. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  31. package/.next/server/app/api/node/events/route/app-paths-manifest.json +3 -0
  32. package/.next/server/app/api/node/events/route/build-manifest.json +11 -0
  33. package/.next/server/app/api/node/events/route/server-reference-manifest.json +4 -0
  34. package/.next/server/app/api/node/events/route.js +7 -0
  35. package/.next/server/app/api/node/events/route.js.map +5 -0
  36. package/.next/server/app/api/node/events/route.js.nft.json +1 -0
  37. package/.next/server/app/api/node/events/route_client-reference-manifest.js +2 -0
  38. package/.next/server/app/api/node/health/route/app-paths-manifest.json +3 -0
  39. package/.next/server/app/api/node/health/route/build-manifest.json +11 -0
  40. package/.next/server/app/api/node/health/route/server-reference-manifest.json +4 -0
  41. package/.next/server/app/api/node/health/route.js +6 -0
  42. package/.next/server/app/api/node/health/route.js.map +5 -0
  43. package/.next/server/app/api/node/health/route.js.nft.json +1 -0
  44. package/.next/server/app/api/node/health/route_client-reference-manifest.js +2 -0
  45. package/.next/server/app/api/node/sessions/route/app-paths-manifest.json +3 -0
  46. package/.next/server/app/api/node/sessions/route/build-manifest.json +11 -0
  47. package/.next/server/app/api/node/sessions/route/server-reference-manifest.json +4 -0
  48. package/.next/server/app/api/node/sessions/route.js +9 -0
  49. package/.next/server/app/api/node/sessions/route.js.map +5 -0
  50. package/.next/server/app/api/node/sessions/route.js.nft.json +1 -0
  51. package/.next/server/app/api/node/sessions/route_client-reference-manifest.js +2 -0
  52. package/.next/server/app/api/nodes/route/app-paths-manifest.json +3 -0
  53. package/.next/server/app/api/nodes/route/build-manifest.json +11 -0
  54. package/.next/server/app/api/nodes/route/server-reference-manifest.json +4 -0
  55. package/.next/server/app/api/nodes/route.js +8 -0
  56. package/.next/server/app/api/nodes/route.js.map +5 -0
  57. package/.next/server/app/api/nodes/route.js.nft.json +1 -0
  58. package/.next/server/app/api/nodes/route_client-reference-manifest.js +2 -0
  59. package/.next/server/app/api/opencode-config/route.js +1 -1
  60. package/.next/server/app/api/opencode-config/route.js.nft.json +1 -1
  61. package/.next/server/app/api/opencode-config/status/route.js +1 -1
  62. package/.next/server/app/api/opencode-config/status/route.js.nft.json +1 -1
  63. package/.next/server/app/api/opencode-events/route.js +4 -2
  64. package/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
  65. package/.next/server/app/api/profiles/[id]/apply/route.js +1 -1
  66. package/.next/server/app/api/profiles/[id]/apply/route.js.nft.json +1 -1
  67. package/.next/server/app/api/profiles/[id]/export/route.js +2 -2
  68. package/.next/server/app/api/profiles/[id]/export/route.js.nft.json +1 -1
  69. package/.next/server/app/api/profiles/[id]/route.js +2 -2
  70. package/.next/server/app/api/profiles/[id]/route.js.nft.json +1 -1
  71. package/.next/server/app/api/profiles/import/route.js +2 -2
  72. package/.next/server/app/api/profiles/import/route.js.nft.json +1 -1
  73. package/.next/server/app/api/profiles/route.js +2 -2
  74. package/.next/server/app/api/profiles/route.js.nft.json +1 -1
  75. package/.next/server/app/api/sessions/[id]/archive/route.js +1 -1
  76. package/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
  77. package/.next/server/app/api/sessions/[id]/delete/route.js +1 -1
  78. package/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
  79. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  80. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  81. package/.next/server/app/api/sessions/route.js +3 -3
  82. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  83. package/.next/server/app/favicon.ico/route.js +1 -1
  84. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  85. package/.next/server/app/index.html +1 -1
  86. package/.next/server/app/index.rsc +3 -3
  87. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  88. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  89. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  90. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  91. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  92. package/.next/server/app/page.js +1 -1
  93. package/.next/server/app/page.js.nft.json +1 -1
  94. package/.next/server/app/page_client-reference-manifest.js +1 -1
  95. package/.next/server/app-paths-manifest.json +4 -0
  96. package/.next/server/chunks/{[root-of-the-server]__172a07b6._.js → [externals]_next_dist_84e7390b._.js} +2 -2
  97. package/.next/server/chunks/[root-of-the-server]__0b017945._.js +3 -0
  98. package/.next/server/chunks/[root-of-the-server]__0b017945._.js.map +1 -0
  99. package/.next/server/chunks/[root-of-the-server]__16a9eb0a._.js +5 -0
  100. package/.next/server/chunks/[root-of-the-server]__16a9eb0a._.js.map +1 -0
  101. package/.next/server/chunks/[root-of-the-server]__192ed2f4._.js +3 -0
  102. package/.next/server/chunks/[root-of-the-server]__192ed2f4._.js.map +1 -0
  103. package/.next/server/chunks/[root-of-the-server]__1e118bd3._.js +3 -0
  104. package/.next/server/chunks/[root-of-the-server]__1e118bd3._.js.map +1 -0
  105. package/.next/server/chunks/{[externals]_next_dist_16542d6b._.js → [root-of-the-server]__56690af0._.js} +2 -2
  106. package/.next/server/chunks/{[root-of-the-server]__172a07b6._.js.map → [root-of-the-server]__56690af0._.js.map} +1 -1
  107. package/.next/server/chunks/[root-of-the-server]__56f5f249._.js +3 -0
  108. package/.next/server/chunks/[root-of-the-server]__56f5f249._.js.map +1 -0
  109. package/.next/server/chunks/[root-of-the-server]__59175de4._.js +3 -0
  110. package/.next/server/chunks/[root-of-the-server]__59175de4._.js.map +1 -0
  111. package/.next/server/chunks/[root-of-the-server]__64fffc02._.js +3 -0
  112. package/.next/server/chunks/[root-of-the-server]__64fffc02._.js.map +1 -0
  113. package/.next/server/chunks/[root-of-the-server]__6979e732._.js +3 -0
  114. package/.next/server/chunks/[root-of-the-server]__6979e732._.js.map +1 -0
  115. package/.next/server/chunks/[root-of-the-server]__7e757f50._.js +3 -0
  116. package/.next/server/chunks/[root-of-the-server]__7e757f50._.js.map +1 -0
  117. package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +3 -0
  118. package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js.map +1 -0
  119. package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +3 -0
  120. package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js.map +1 -0
  121. package/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js +3 -0
  122. package/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js.map +1 -0
  123. package/.next/server/chunks/[root-of-the-server]__b698889b._.js +3 -0
  124. package/.next/server/chunks/[root-of-the-server]__b698889b._.js.map +1 -0
  125. package/.next/server/chunks/[root-of-the-server]__b796d06c._.js +3 -0
  126. package/.next/server/chunks/{[root-of-the-server]__2c3e3de2._.js.map → [root-of-the-server]__b796d06c._.js.map} +1 -1
  127. package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +3 -0
  128. package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js.map +1 -0
  129. package/.next/server/chunks/[root-of-the-server]__ddc251b7._.js +3 -0
  130. package/.next/server/chunks/[root-of-the-server]__ddc251b7._.js.map +1 -0
  131. package/.next/server/chunks/_next-internal_server_app_api_node_events_route_actions_f1abd32d.js +3 -0
  132. package/.next/server/chunks/_next-internal_server_app_api_node_events_route_actions_f1abd32d.js.map +1 -0
  133. package/.next/server/chunks/_next-internal_server_app_api_node_health_route_actions_c4c4c077.js +3 -0
  134. package/.next/server/chunks/_next-internal_server_app_api_node_health_route_actions_c4c4c077.js.map +1 -0
  135. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_route_actions_6b564c5a.js +3 -0
  136. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_route_actions_6b564c5a.js.map +1 -0
  137. package/.next/server/chunks/_next-internal_server_app_api_nodes_route_actions_3e496ee8.js +3 -0
  138. package/.next/server/chunks/_next-internal_server_app_api_nodes_route_actions_3e496ee8.js.map +1 -0
  139. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js +3 -0
  140. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js.map +1 -0
  141. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
  142. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js.map +1 -1
  143. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +5 -0
  144. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js.map +1 -0
  145. package/.next/server/chunks/ssr/[root-of-the-server]__b0788643._.js +3 -0
  146. package/.next/server/chunks/ssr/{[root-of-the-server]__39eef6a5._.js → [root-of-the-server]__efc52f08._.js} +2 -2
  147. package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
  148. package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js.map +1 -1
  149. package/.next/server/pages/404.html +1 -1
  150. package/.next/server/pages/500.html +2 -2
  151. package/.next/server/server-reference-manifest.js +1 -1
  152. package/.next/server/server-reference-manifest.json +1 -1
  153. package/.next/standalone/.next/BUILD_ID +1 -1
  154. package/.next/standalone/.next/app-path-routes-manifest.json +4 -0
  155. package/.next/standalone/.next/build-manifest.json +2 -2
  156. package/.next/standalone/.next/prerender-manifest.json +3 -3
  157. package/.next/standalone/.next/routes-manifest.json +24 -0
  158. package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
  159. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  161. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  162. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  163. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  164. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  165. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  166. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  167. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  168. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  169. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  170. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  171. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  172. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  173. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  174. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  175. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  176. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  177. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  178. package/.next/standalone/.next/server/app/api/node/events/route/app-paths-manifest.json +3 -0
  179. package/.next/standalone/.next/server/app/api/node/events/route/build-manifest.json +11 -0
  180. package/.next/standalone/.next/server/app/api/node/events/route/server-reference-manifest.json +4 -0
  181. package/.next/standalone/.next/server/app/api/node/events/route.js +7 -0
  182. package/.next/standalone/.next/server/app/api/node/events/route.js.map +5 -0
  183. package/.next/standalone/.next/server/app/api/node/events/route.js.nft.json +1 -0
  184. package/.next/standalone/.next/server/app/api/node/events/route_client-reference-manifest.js +2 -0
  185. package/.next/standalone/.next/server/app/api/node/health/route/app-paths-manifest.json +3 -0
  186. package/.next/standalone/.next/server/app/api/node/health/route/build-manifest.json +11 -0
  187. package/.next/standalone/.next/server/app/api/node/health/route/server-reference-manifest.json +4 -0
  188. package/.next/standalone/.next/server/app/api/node/health/route.js +6 -0
  189. package/.next/standalone/.next/server/app/api/node/health/route.js.map +5 -0
  190. package/.next/standalone/.next/server/app/api/node/health/route.js.nft.json +1 -0
  191. package/.next/standalone/.next/server/app/api/node/health/route_client-reference-manifest.js +2 -0
  192. package/.next/standalone/.next/server/app/api/node/sessions/route/app-paths-manifest.json +3 -0
  193. package/.next/standalone/.next/server/app/api/node/sessions/route/build-manifest.json +11 -0
  194. package/.next/standalone/.next/server/app/api/node/sessions/route/server-reference-manifest.json +4 -0
  195. package/.next/standalone/.next/server/app/api/node/sessions/route.js +9 -0
  196. package/.next/standalone/.next/server/app/api/node/sessions/route.js.map +5 -0
  197. package/.next/standalone/.next/server/app/api/node/sessions/route.js.nft.json +1 -0
  198. package/.next/standalone/.next/server/app/api/node/sessions/route_client-reference-manifest.js +2 -0
  199. package/.next/standalone/.next/server/app/api/nodes/route/app-paths-manifest.json +3 -0
  200. package/.next/standalone/.next/server/app/api/nodes/route/build-manifest.json +11 -0
  201. package/.next/standalone/.next/server/app/api/nodes/route/server-reference-manifest.json +4 -0
  202. package/.next/standalone/.next/server/app/api/nodes/route.js +8 -0
  203. package/.next/standalone/.next/server/app/api/nodes/route.js.map +5 -0
  204. package/.next/standalone/.next/server/app/api/nodes/route.js.nft.json +1 -0
  205. package/.next/standalone/.next/server/app/api/nodes/route_client-reference-manifest.js +2 -0
  206. package/.next/standalone/.next/server/app/api/opencode-config/route.js +1 -1
  207. package/.next/standalone/.next/server/app/api/opencode-config/route.js.nft.json +1 -1
  208. package/.next/standalone/.next/server/app/api/opencode-config/status/route.js +1 -1
  209. package/.next/standalone/.next/server/app/api/opencode-config/status/route.js.nft.json +1 -1
  210. package/.next/standalone/.next/server/app/api/opencode-events/route.js +4 -2
  211. package/.next/standalone/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
  212. package/.next/standalone/.next/server/app/api/profiles/[id]/apply/route.js +1 -1
  213. package/.next/standalone/.next/server/app/api/profiles/[id]/apply/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/api/profiles/[id]/export/route.js +2 -2
  215. package/.next/standalone/.next/server/app/api/profiles/[id]/export/route.js.nft.json +1 -1
  216. package/.next/standalone/.next/server/app/api/profiles/[id]/route.js +2 -2
  217. package/.next/standalone/.next/server/app/api/profiles/[id]/route.js.nft.json +1 -1
  218. package/.next/standalone/.next/server/app/api/profiles/import/route.js +2 -2
  219. package/.next/standalone/.next/server/app/api/profiles/import/route.js.nft.json +1 -1
  220. package/.next/standalone/.next/server/app/api/profiles/route.js +2 -2
  221. package/.next/standalone/.next/server/app/api/profiles/route.js.nft.json +1 -1
  222. package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js +1 -1
  223. package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
  224. package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js +1 -1
  225. package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
  226. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js +1 -1
  227. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  228. package/.next/standalone/.next/server/app/api/sessions/route.js +3 -3
  229. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  230. package/.next/standalone/.next/server/app/favicon.ico/route.js +1 -1
  231. package/.next/standalone/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  232. package/.next/standalone/.next/server/app/index.html +1 -1
  233. package/.next/standalone/.next/server/app/index.rsc +3 -3
  234. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  235. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  236. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  237. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  238. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  239. package/.next/standalone/.next/server/app/page.js +1 -1
  240. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  241. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  242. package/.next/standalone/.next/server/app-paths-manifest.json +4 -0
  243. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__172a07b6._.js → [externals]_next_dist_84e7390b._.js} +2 -2
  244. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b017945._.js +3 -0
  245. package/.next/standalone/.next/server/chunks/[root-of-the-server]__16a9eb0a._.js +5 -0
  246. package/.next/standalone/.next/server/chunks/[root-of-the-server]__192ed2f4._.js +3 -0
  247. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1e118bd3._.js +3 -0
  248. package/.next/standalone/.next/server/chunks/{[externals]_next_dist_16542d6b._.js → [root-of-the-server]__56690af0._.js} +2 -2
  249. package/.next/standalone/.next/server/chunks/[root-of-the-server]__56f5f249._.js +3 -0
  250. package/.next/standalone/.next/server/chunks/[root-of-the-server]__59175de4._.js +3 -0
  251. package/.next/standalone/.next/server/chunks/[root-of-the-server]__64fffc02._.js +3 -0
  252. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6979e732._.js +3 -0
  253. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7e757f50._.js +3 -0
  254. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +3 -0
  255. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +3 -0
  256. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js +3 -0
  257. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b698889b._.js +3 -0
  258. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b796d06c._.js +3 -0
  259. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +3 -0
  260. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ddc251b7._.js +3 -0
  261. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_events_route_actions_f1abd32d.js +3 -0
  262. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_health_route_actions_c4c4c077.js +3 -0
  263. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_route_actions_6b564c5a.js +3 -0
  264. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_nodes_route_actions_3e496ee8.js +3 -0
  265. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js +3 -0
  266. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
  267. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +5 -0
  268. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__b0788643._.js +3 -0
  269. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__39eef6a5._.js → [root-of-the-server]__efc52f08._.js} +2 -2
  270. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
  271. package/.next/standalone/.next/server/pages/404.html +1 -1
  272. package/.next/standalone/.next/server/pages/500.html +2 -2
  273. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  274. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  275. package/.next/standalone/.next/static/chunks/9f8c22002e7395e8.js +13 -0
  276. package/.next/standalone/.next/static/chunks/f1b55db60e7ed6f3.css +3 -0
  277. package/.next/standalone/package.json +4 -2
  278. package/.next/standalone/public/readme-cover.png +0 -0
  279. package/.next/static/chunks/9f8c22002e7395e8.js +13 -0
  280. package/.next/static/chunks/f1b55db60e7ed6f3.css +3 -0
  281. package/.next/trace +1 -1
  282. package/.next/trace-build +1 -1
  283. package/.next/types/routes.d.ts +5 -1
  284. package/.next/types/validator.ts +36 -0
  285. package/README.md +28 -11
  286. package/bin/dev-runtime.js +58 -0
  287. package/bin/vibepulse.js +72 -39
  288. package/package.json +4 -2
  289. package/public/readme-cover.png +0 -0
  290. package/.next/server/chunks/[root-of-the-server]__07488412._.js +0 -3
  291. package/.next/server/chunks/[root-of-the-server]__07488412._.js.map +0 -1
  292. package/.next/server/chunks/[root-of-the-server]__07649a30._.js +0 -3
  293. package/.next/server/chunks/[root-of-the-server]__07649a30._.js.map +0 -1
  294. package/.next/server/chunks/[root-of-the-server]__1bf88ae0._.js +0 -3
  295. package/.next/server/chunks/[root-of-the-server]__1bf88ae0._.js.map +0 -1
  296. package/.next/server/chunks/[root-of-the-server]__2c3e3de2._.js +0 -3
  297. package/.next/server/chunks/[root-of-the-server]__560e7c61._.js +0 -3
  298. package/.next/server/chunks/[root-of-the-server]__560e7c61._.js.map +0 -1
  299. package/.next/server/chunks/[root-of-the-server]__9f034d03._.js +0 -5
  300. package/.next/server/chunks/[root-of-the-server]__9f034d03._.js.map +0 -1
  301. package/.next/server/chunks/[root-of-the-server]__a84faf4b._.js +0 -3
  302. package/.next/server/chunks/[root-of-the-server]__a84faf4b._.js.map +0 -1
  303. package/.next/server/chunks/[root-of-the-server]__b92251ea._.js +0 -3
  304. package/.next/server/chunks/[root-of-the-server]__b92251ea._.js.map +0 -1
  305. package/.next/server/chunks/[root-of-the-server]__e7a766a0._.js +0 -3
  306. package/.next/server/chunks/[root-of-the-server]__e7a766a0._.js.map +0 -1
  307. package/.next/server/chunks/[root-of-the-server]__f234882e._.js +0 -3
  308. package/.next/server/chunks/[root-of-the-server]__f234882e._.js.map +0 -1
  309. package/.next/server/chunks/[root-of-the-server]__f85221b8._.js +0 -3
  310. package/.next/server/chunks/[root-of-the-server]__f85221b8._.js.map +0 -1
  311. package/.next/server/chunks/ssr/[root-of-the-server]__535a2208._.js +0 -3
  312. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07488412._.js +0 -3
  313. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07649a30._.js +0 -3
  314. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1bf88ae0._.js +0 -3
  315. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2c3e3de2._.js +0 -3
  316. package/.next/standalone/.next/server/chunks/[root-of-the-server]__560e7c61._.js +0 -3
  317. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9f034d03._.js +0 -5
  318. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a84faf4b._.js +0 -3
  319. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b92251ea._.js +0 -3
  320. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e7a766a0._.js +0 -3
  321. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f234882e._.js +0 -3
  322. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f85221b8._.js +0 -3
  323. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__535a2208._.js +0 -3
  324. package/.next/standalone/.next/static/chunks/ca49cb2092c277d2.js +0 -13
  325. package/.next/standalone/.next/static/chunks/dc07499869593595.css +0 -3
  326. package/.next/static/chunks/ca49cb2092c277d2.js +0 -13
  327. package/.next/static/chunks/dc07499869593595.css +0 -3
  328. /package/.next/server/chunks/{[externals]_next_dist_16542d6b._.js.map → [externals]_next_dist_84e7390b._.js.map} +0 -0
  329. /package/.next/server/chunks/ssr/{[root-of-the-server]__535a2208._.js.map → [root-of-the-server]__b0788643._.js.map} +0 -0
  330. /package/.next/server/chunks/ssr/{[root-of-the-server]__39eef6a5._.js.map → [root-of-the-server]__efc52f08._.js.map} +0 -0
  331. /package/.next/standalone/.next/static/{78EwnRx2m70qyfCL0X4sH → L_tmqf71LaeMzApO4SiU-}/_buildManifest.js +0 -0
  332. /package/.next/standalone/.next/static/{78EwnRx2m70qyfCL0X4sH → L_tmqf71LaeMzApO4SiU-}/_clientMiddlewareManifest.json +0 -0
  333. /package/.next/standalone/.next/static/{78EwnRx2m70qyfCL0X4sH → L_tmqf71LaeMzApO4SiU-}/_ssgManifest.js +0 -0
  334. /package/.next/static/{78EwnRx2m70qyfCL0X4sH → L_tmqf71LaeMzApO4SiU-}/_buildManifest.js +0 -0
  335. /package/.next/static/{78EwnRx2m70qyfCL0X4sH → L_tmqf71LaeMzApO4SiU-}/_clientMiddlewareManifest.json +0 -0
  336. /package/.next/static/{78EwnRx2m70qyfCL0X4sH → L_tmqf71LaeMzApO4SiU-}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/runtimeMode.ts","../../../src/lib/nodeRegistry.ts","../../../src/app/api/nodes/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["export const NODE_RUNTIME_FLAG = '--serve';\nexport const RUNTIME_ROLE_ENV_VAR = 'VIBEPULSE_RUNTIME_ROLE';\n\nexport type RuntimeRole = 'hub' | 'node';\n\nexport interface RuntimeMode {\n role: RuntimeRole;\n}\n\nfunction formatUsage(args: string[]): string {\n const renderedArgs = args.length > 0 ? args.join(' ') : '(none)';\n return `Unsupported arguments: ${renderedArgs}. Usage: vibepulse [${NODE_RUNTIME_FLAG}]`;\n}\n\nexport function resolveRuntimeMode(argv: string[]): RuntimeMode {\n if (!Array.isArray(argv)) {\n throw new TypeError('Runtime arguments must be provided as an array.');\n }\n\n if (argv.length === 0) {\n return { role: 'hub' };\n }\n\n if (argv.length === 1 && argv[0] === NODE_RUNTIME_FLAG) {\n return { role: 'node' };\n }\n\n throw new Error(formatUsage(argv));\n}\n","import { existsSync, mkdirSync } from 'fs';\nimport { readFile, writeFile } from 'fs/promises';\nimport { homedir } from 'os';\nimport { join } from 'path';\nimport { randomUUID } from 'crypto';\nimport { parse, stringify } from 'comment-json';\n\nexport const NODES_CONFIG_DIR = join(homedir(), '.config', 'vibepulse');\nexport const NODE_REGISTRY_PATH = join(NODES_CONFIG_DIR, 'nodes.jsonc');\n\nexport interface StoredNodeRecord {\n nodeId: string;\n nodeLabel: string;\n baseUrl: string;\n enabled: boolean;\n token: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface PublicNodeRecord {\n nodeId: string;\n nodeLabel: string;\n baseUrl: string;\n enabled: boolean;\n createdAt: string;\n updatedAt: string;\n tokenConfigured: boolean;\n}\n\ninterface NodeRegistryFile {\n version: number;\n nodes: StoredNodeRecord[];\n}\n\nexport type NodeBaseUrlValidationError =\n | 'empty'\n | 'invalid'\n | 'unsupported_protocol'\n | 'credentials_not_allowed';\n\ntype NodeBaseUrlValidationResult =\n | { ok: true; normalizedBaseUrl: string }\n | { ok: false; error: NodeBaseUrlValidationError };\n\nexport type NodeRegistryErrorCode =\n | 'node_not_found'\n | 'node_label_required'\n | 'node_id_required'\n | 'invalid_token'\n | 'invalid_enabled'\n | 'invalid_base_url'\n | 'duplicate_base_url'\n | 'no_updates';\n\nexport class NodeRegistryError extends Error {\n readonly code: NodeRegistryErrorCode;\n\n constructor(code: NodeRegistryErrorCode, message: string) {\n super(message);\n this.name = 'NodeRegistryError';\n this.code = code;\n }\n}\n\nfunction normalizeParsedBaseUrl(url: URL): string {\n url.search = '';\n url.hash = '';\n return url.toString().replace(/\\/+$/, '');\n}\n\nexport function validateNodeBaseUrl(url: string): NodeBaseUrlValidationResult {\n const trimmedUrl = url.trim();\n if (!trimmedUrl) {\n return { ok: false, error: 'empty' };\n }\n\n try {\n const parsed = new URL(trimmedUrl);\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n return { ok: false, error: 'unsupported_protocol' };\n }\n\n if (parsed.username || parsed.password) {\n return { ok: false, error: 'credentials_not_allowed' };\n }\n\n return { ok: true, normalizedBaseUrl: normalizeParsedBaseUrl(parsed) };\n } catch {\n return { ok: false, error: 'invalid' };\n }\n}\n\nfunction normalizeStoredNode(node: unknown): StoredNodeRecord | null {\n if (!node || typeof node !== 'object') {\n return null;\n }\n\n const candidate = node as Record<string, unknown>;\n if (\n typeof candidate.nodeId !== 'string' ||\n typeof candidate.nodeLabel !== 'string' ||\n typeof candidate.baseUrl !== 'string' ||\n typeof candidate.enabled !== 'boolean' ||\n typeof candidate.token !== 'string' ||\n typeof candidate.createdAt !== 'string' ||\n typeof candidate.updatedAt !== 'string'\n ) {\n return null;\n }\n\n const validation = validateNodeBaseUrl(candidate.baseUrl);\n if (!validation.ok) {\n return null;\n }\n\n const nodeId = candidate.nodeId.trim();\n const nodeLabel = candidate.nodeLabel.trim();\n\n if (!nodeId || !nodeLabel) {\n return null;\n }\n\n return {\n nodeId,\n nodeLabel,\n baseUrl: validation.normalizedBaseUrl,\n enabled: candidate.enabled,\n token: candidate.token.trim(),\n createdAt: candidate.createdAt,\n updatedAt: candidate.updatedAt,\n };\n}\n\nfunction ensureNodesConfigDir(): void {\n if (!existsSync(NODES_CONFIG_DIR)) {\n mkdirSync(NODES_CONFIG_DIR, { recursive: true });\n }\n}\n\nfunction defaultRegistry(): NodeRegistryFile {\n return {\n version: 1,\n nodes: [],\n };\n}\n\nasync function readRegistryFile(): Promise<NodeRegistryFile> {\n try {\n ensureNodesConfigDir();\n\n if (!existsSync(NODE_REGISTRY_PATH)) {\n const initial = defaultRegistry();\n await writeRegistryFile(initial);\n return initial;\n }\n\n const raw = await readFile(NODE_REGISTRY_PATH, 'utf-8');\n const parsed = parse(raw, null, false) as unknown;\n\n if (!parsed || typeof parsed !== 'object') {\n return defaultRegistry();\n }\n\n const registry = parsed as Record<string, unknown>;\n if (!Array.isArray(registry.nodes)) {\n return defaultRegistry();\n }\n\n const normalizedNodes = registry.nodes\n .map(normalizeStoredNode)\n .filter((node): node is StoredNodeRecord => node !== null);\n\n const dedupedNodes: StoredNodeRecord[] = [];\n const seenBaseUrls = new Set<string>();\n for (const node of normalizedNodes) {\n if (seenBaseUrls.has(node.baseUrl)) {\n continue;\n }\n seenBaseUrls.add(node.baseUrl);\n dedupedNodes.push(node);\n }\n\n return {\n version: typeof registry.version === 'number' ? registry.version : 1,\n nodes: dedupedNodes,\n };\n } catch {\n return defaultRegistry();\n }\n}\n\nasync function writeRegistryFile(registry: NodeRegistryFile): Promise<void> {\n ensureNodesConfigDir();\n const content = stringify(registry, null, 2);\n await writeFile(NODE_REGISTRY_PATH, content, 'utf-8');\n}\n\nexport function sanitizeNodeRecord(node: StoredNodeRecord): PublicNodeRecord {\n return {\n nodeId: node.nodeId,\n nodeLabel: node.nodeLabel,\n baseUrl: node.baseUrl,\n enabled: node.enabled,\n createdAt: node.createdAt,\n updatedAt: node.updatedAt,\n tokenConfigured: node.token.trim().length > 0,\n };\n}\n\nfunction assertNodeLabel(label: unknown): string {\n if (typeof label !== 'string' || label.trim() === '') {\n throw new NodeRegistryError('node_label_required', 'nodeLabel is required and must be a non-empty string');\n }\n return label.trim();\n}\n\nfunction assertNodeId(nodeId: unknown): string {\n if (typeof nodeId !== 'string' || nodeId.trim() === '') {\n throw new NodeRegistryError('node_id_required', 'nodeId is required and must be a non-empty string');\n }\n return nodeId.trim();\n}\n\nfunction normalizeOptionalToken(token: unknown): string {\n if (token === undefined || token === null) {\n return '';\n }\n\n if (typeof token !== 'string') {\n throw new NodeRegistryError('invalid_token', 'token must be a string when provided');\n }\n\n return token.trim();\n}\n\nfunction assertEnabled(value: unknown): boolean {\n if (typeof value !== 'boolean') {\n throw new NodeRegistryError('invalid_enabled', 'enabled must be a boolean');\n }\n return value;\n}\n\nfunction assertAndNormalizeBaseUrl(baseUrl: unknown): string {\n if (typeof baseUrl !== 'string') {\n throw new NodeRegistryError('invalid_base_url', 'baseUrl must be a string');\n }\n\n const validation = validateNodeBaseUrl(baseUrl);\n if (!validation.ok) {\n throw new NodeRegistryError(\n 'invalid_base_url',\n `baseUrl validation failed: ${validation.error}`\n );\n }\n\n return validation.normalizedBaseUrl;\n}\n\nfunction assertUniqueBaseUrl(nodes: StoredNodeRecord[], normalizedBaseUrl: string, ignoreNodeId?: string): void {\n const duplicate = nodes.find(node => node.baseUrl === normalizedBaseUrl && node.nodeId !== ignoreNodeId);\n if (duplicate) {\n throw new NodeRegistryError(\n 'duplicate_base_url',\n `A node with baseUrl '${normalizedBaseUrl}' already exists`\n );\n }\n}\n\nexport async function listNodeRecords(): Promise<StoredNodeRecord[]> {\n const registry = await readRegistryFile();\n return [...registry.nodes];\n}\n\nexport async function listNodes(): Promise<PublicNodeRecord[]> {\n const nodes = await listNodeRecords();\n return nodes.map(sanitizeNodeRecord);\n}\n\nexport interface CreateNodeInput {\n nodeLabel: string;\n baseUrl: string;\n token?: string;\n enabled?: boolean;\n}\n\nexport interface UpdateNodeInput {\n nodeLabel?: string;\n baseUrl?: string;\n token?: string;\n enabled?: boolean;\n}\n\nexport async function createNode(input: CreateNodeInput): Promise<PublicNodeRecord> {\n const nodeLabel = assertNodeLabel(input.nodeLabel);\n const baseUrl = assertAndNormalizeBaseUrl(input.baseUrl);\n const token = normalizeOptionalToken(input.token);\n const enabled = input.enabled === undefined ? true : assertEnabled(input.enabled);\n\n const registry = await readRegistryFile();\n assertUniqueBaseUrl(registry.nodes, baseUrl);\n\n const now = new Date().toISOString();\n const record: StoredNodeRecord = {\n nodeId: randomUUID(),\n nodeLabel,\n baseUrl,\n enabled,\n token,\n createdAt: now,\n updatedAt: now,\n };\n\n registry.nodes.push(record);\n await writeRegistryFile(registry);\n\n return sanitizeNodeRecord(record);\n}\n\nexport async function updateNode(nodeIdInput: unknown, updates: UpdateNodeInput): Promise<PublicNodeRecord> {\n const nodeId = assertNodeId(nodeIdInput);\n\n const hasAnyUpdate =\n updates.nodeLabel !== undefined ||\n updates.baseUrl !== undefined ||\n updates.token !== undefined ||\n updates.enabled !== undefined;\n\n if (!hasAnyUpdate) {\n throw new NodeRegistryError('no_updates', 'At least one update field is required');\n }\n\n const registry = await readRegistryFile();\n const index = registry.nodes.findIndex(node => node.nodeId === nodeId);\n if (index === -1) {\n throw new NodeRegistryError('node_not_found', `Node '${nodeId}' not found`);\n }\n\n const current = registry.nodes[index];\n\n const nextNodeLabel = updates.nodeLabel === undefined ? current.nodeLabel : assertNodeLabel(updates.nodeLabel);\n const nextBaseUrl = updates.baseUrl === undefined ? current.baseUrl : assertAndNormalizeBaseUrl(updates.baseUrl);\n const nextToken = updates.token === undefined ? current.token : normalizeOptionalToken(updates.token);\n const nextEnabled = updates.enabled === undefined ? current.enabled : assertEnabled(updates.enabled);\n\n assertUniqueBaseUrl(registry.nodes, nextBaseUrl, current.nodeId);\n\n const updated: StoredNodeRecord = {\n ...current,\n nodeLabel: nextNodeLabel,\n baseUrl: nextBaseUrl,\n token: nextToken,\n enabled: nextEnabled,\n updatedAt: new Date().toISOString(),\n };\n\n registry.nodes[index] = updated;\n await writeRegistryFile(registry);\n\n return sanitizeNodeRecord(updated);\n}\n\nexport async function toggleNode(nodeIdInput: unknown, enabled?: unknown): Promise<PublicNodeRecord> {\n const nodeId = assertNodeId(nodeIdInput);\n\n const registry = await readRegistryFile();\n const index = registry.nodes.findIndex(node => node.nodeId === nodeId);\n if (index === -1) {\n throw new NodeRegistryError('node_not_found', `Node '${nodeId}' not found`);\n }\n\n const current = registry.nodes[index];\n const nextEnabled = enabled === undefined ? !current.enabled : assertEnabled(enabled);\n const updated: StoredNodeRecord = {\n ...current,\n enabled: nextEnabled,\n updatedAt: new Date().toISOString(),\n };\n\n registry.nodes[index] = updated;\n await writeRegistryFile(registry);\n\n return sanitizeNodeRecord(updated);\n}\n\nexport async function deleteNode(nodeIdInput: unknown): Promise<boolean> {\n const nodeId = assertNodeId(nodeIdInput);\n\n const registry = await readRegistryFile();\n const nextNodes = registry.nodes.filter(node => node.nodeId !== nodeId);\n if (nextNodes.length === registry.nodes.length) {\n return false;\n }\n\n registry.nodes = nextNodes;\n await writeRegistryFile(registry);\n return true;\n}\n","import { NextRequest, NextResponse } from 'next/server';\nimport {\n NodeRegistryError,\n createNode,\n deleteNode,\n listNodes,\n toggleNode,\n updateNode,\n} from '@/lib/nodeRegistry';\nimport { RUNTIME_ROLE_ENV_VAR } from '@/lib/runtimeMode';\n\nfunction requireHubRuntime(): NextResponse | null {\n if (process.env[RUNTIME_ROLE_ENV_VAR] === 'node') {\n return NextResponse.json({ error: 'Route unavailable in node mode' }, { status: 404 });\n }\n\n return null;\n}\n\nfunction mapRegistryError(error: NodeRegistryError): { status: number; payload: Record<string, unknown> } {\n if (error.code === 'node_not_found') {\n return {\n status: 404,\n payload: {\n error: error.message,\n code: error.code,\n },\n };\n }\n\n if (error.code === 'duplicate_base_url') {\n return {\n status: 409,\n payload: {\n error: error.message,\n code: error.code,\n },\n };\n }\n\n return {\n status: 400,\n payload: {\n error: error.message,\n code: error.code,\n },\n };\n}\n\nfunction handleUnknownError(error: unknown, fallbackMessage: string): NextResponse {\n if (error instanceof NodeRegistryError) {\n const mapped = mapRegistryError(error);\n return NextResponse.json(mapped.payload, { status: mapped.status });\n }\n\n console.error(fallbackMessage, error);\n return NextResponse.json({ error: 'Internal server error' }, { status: 500 });\n}\n\nasync function parseJsonBody(request: NextRequest): Promise<Record<string, unknown> | null> {\n try {\n const body = await request.json();\n if (!body || typeof body !== 'object' || Array.isArray(body)) {\n return null;\n }\n return body as Record<string, unknown>;\n } catch {\n return null;\n }\n}\n\nexport async function GET() {\n const guardResponse = requireHubRuntime();\n if (guardResponse) {\n return guardResponse;\n }\n\n try {\n const nodes = await listNodes();\n return NextResponse.json({ nodes });\n } catch (error) {\n return handleUnknownError(error, 'Error listing nodes:');\n }\n}\n\nexport async function POST(request: NextRequest) {\n const guardResponse = requireHubRuntime();\n if (guardResponse) {\n return guardResponse;\n }\n\n const body = await parseJsonBody(request);\n if (!body) {\n return NextResponse.json({ error: 'Invalid request body' }, { status: 400 });\n }\n\n try {\n const node = await createNode({\n nodeLabel: body.nodeLabel as string,\n baseUrl: body.baseUrl as string,\n token: body.token as string,\n enabled: body.enabled as boolean | undefined,\n });\n\n return NextResponse.json({ node }, { status: 201 });\n } catch (error) {\n return handleUnknownError(error, 'Error creating node:');\n }\n}\n\nexport async function PUT(request: NextRequest) {\n const guardResponse = requireHubRuntime();\n if (guardResponse) {\n return guardResponse;\n }\n\n const body = await parseJsonBody(request);\n if (!body) {\n return NextResponse.json({ error: 'Invalid request body' }, { status: 400 });\n }\n\n try {\n const node = await updateNode(body.nodeId, {\n nodeLabel: body.nodeLabel as string | undefined,\n baseUrl: body.baseUrl as string | undefined,\n token: body.token as string | undefined,\n enabled: body.enabled as boolean | undefined,\n });\n\n return NextResponse.json({ node });\n } catch (error) {\n return handleUnknownError(error, 'Error updating node:');\n }\n}\n\nexport async function PATCH(request: NextRequest) {\n const guardResponse = requireHubRuntime();\n if (guardResponse) {\n return guardResponse;\n }\n\n const body = await parseJsonBody(request);\n if (!body) {\n return NextResponse.json({ error: 'Invalid request body' }, { status: 400 });\n }\n\n try {\n const node = await toggleNode(body.nodeId, body.enabled);\n return NextResponse.json({ node });\n } catch (error) {\n return handleUnknownError(error, 'Error toggling node:');\n }\n}\n\nexport async function DELETE(request: NextRequest) {\n const guardResponse = requireHubRuntime();\n if (guardResponse) {\n return guardResponse;\n }\n\n const body = await parseJsonBody(request);\n if (!body) {\n return NextResponse.json({ error: 'Invalid request body' }, { status: 400 });\n }\n\n try {\n const deleted = await deleteNode(body.nodeId);\n if (!deleted) {\n return NextResponse.json({ error: `Node '${String(body.nodeId)}' not found`, code: 'node_not_found' }, { status: 404 });\n }\n\n return NextResponse.json({ deleted: true, nodeId: body.nodeId });\n } catch (error) {\n return handleUnknownError(error, 'Error deleting node:');\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 = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/nodes/route\",\n pathname: \"/api/nodes\",\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/nodes/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/nodes/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":"4kCACoC,kHCDpC,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,OAEO,IAAM,EAAmB,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,UAAW,aAC9C,EAAqB,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAkB,cA+ClD,OAAM,UAA0B,MAC5B,IAA4B,AAErC,aAAY,CAA2B,CAAE,CAAe,CAAE,CACxD,KAAK,CAAC,GACN,IAAI,CAAC,IAAI,CAAG,oBACZ,IAAI,CAAC,IAAI,CAAG,CACd,CACF,CAQO,SAAS,EAAoB,CAAW,EAC7C,IAAM,EAAa,EAAI,IAAI,GAC3B,GAAI,CAAC,EACH,MAAO,CAAE,GADM,CACF,EAAO,MAAO,OAAQ,EAGrC,GAAI,CACF,IAAM,EAAS,IAAI,IAAI,GACvB,GAAwB,UAApB,EAAO,QAAQ,EAAoC,UAAU,CAA9B,EAAO,QAAQ,CAChD,MAAO,CAAE,IAAI,EAAO,MAAO,sBAAuB,EAGpD,GAAI,EAAO,QAAQ,EAAI,EAAO,QAAQ,CACpC,CADsC,KAC/B,CAAE,GAAI,GAAO,MAAO,yBAA0B,EAGvD,MAAO,CAAE,IAAI,EAAM,iBAAA,EAAmB,AArBxC,EAAI,MAAM,CAAG,GAq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,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,GATmB,AAShB,EAAY,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":[3]}
@@ -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"))},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"))},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"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},99686,e=>{"use strict";var t=e.i(33405);let r=new Set;function n(){let e=Number(process.env.OPENCODE_DISCOVERY_TIMEOUT_MS);return Number.isFinite(e)&&e>0?e:5e3}function o(e){if(!(e instanceof Error))return!1;let t=e.message.toLowerCase();return"ETIMEDOUT"===e.code||t.includes("timed out")||t.includes("etimedout")}function i(e){let t=e.deadlineMs-Date.now();return t<=0?(e.timedOut=!0,null):Math.max(1,Math.min(e.timeoutMs,t))}function s(e){return Array.from(new Set(e.filter(e=>Number.isInteger(e)&&e>0&&e<=65535))).sort((e,t)=>e-t)}function a(){let e=n(),a={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},l=s([...function(e){try{let r=i(e);if(null===r)return[];let n=(0,t.execSync)("lsof -nP -iTCP -sTCP:LISTEN",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}).split("\n"),o=[];for(let e of n){let t=e.trim();if(!t||t.startsWith("COMMAND"))continue;let r=t.split(/\s+/),n=r[0]?.toLowerCase();if("opencode"!==n)continue;let i=t.match(/:(\d+)\s+\(LISTEN\)/);if(!i)continue;let s=parseInt(i[1],10);Number.isFinite(s)&&o.push(s)}return o}catch(t){return o(t)&&(e.timedOut=!0),[]}}(a),...function(e){try{let r=i(e);if(null===r)return[];return[...(0,t.execSync)("ps -axo command",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}).matchAll(/\bopencode\b[^\n]*\b--port(?:=|\s+)(\d+)\b/g)].map(e=>parseInt(e[1],10)).filter(e=>Number.isFinite(e))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(a)]);for(let e of l)r.add(e);return{ports:s([...l,...Array.from(r)]),timedOut:a.timedOut}}function l(){let e=n(),r={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},s=function(e){try{let r=i(e);if(null===r)return[];let n=(0,t.execSync)("ps -axo pid=,command=",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}),o=[];for(let e of n.split("\n")){let t=e.trim();if(!t)continue;let r=t.match(/^(\d+)\s+(.+)$/);if(!r)continue;let n=parseInt(r[1],10),i=r[2];Number.isFinite(n)&&/\bopencode\b/.test(i)&&(/\b--port(?:=|\s+)\d+\b/.test(i)||o.push(n))}return Array.from(new Set(o))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(r);if(!s.length)return{processes:[],timedOut:r.timedOut};let a=[],l=new Set;for(let e of s){let n=function(e,r){try{let n=i(r);if(null===n)return null;let o=(0,t.execSync)(`lsof -nP -a -p ${e} -d cwd -Fn`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:n}).split("\n").find(e=>e.startsWith("n")&&e.length>1);if(!o)return null;return o.slice(1)}catch(e){return o(e)&&(r.timedOut=!0),null}}(e,r);if(!n)continue;let s=`${e}:${n}`;l.has(s)||(l.add(s),a.push({pid:e,cwd:n}))}return{processes:a,timedOut:r.timedOut}}e.s(["discoverOpencodePortsWithMeta",()=>a,"discoverOpencodeProcessCwdsWithoutPortWithMeta",()=>l])},586,e=>{"use strict";function t(e,t){if(!e||""===e.trim())throw Error("Invalid hostId: cannot be empty");if(!t||""===t.trim())throw Error("Invalid sessionId: cannot be empty");if(e.includes(":")||t.includes(":"))throw Error("Invalid hostId or sessionId: colon character not allowed");return`${e}:${t}`}function r(e){if("string"!=typeof e)throw Error("Invalid sourceKey: must be a string");let t=e.split(":");if(2!==t.length)throw Error("Invalid sourceKey: must contain exactly one colon separator");let[r,n]=t,o=r.trim(),i=n.trim();if(""===o||""===i)throw Error("Invalid sourceKey: hostId and sessionId cannot be empty");return{hostId:o,sessionId:i}}e.s(["composeSourceKey",()=>t,"parseSourceKey",()=>r])},74579,e=>{"use strict";let t=new Map,r=new Map;function n(e){for(let[t,n]of r)e-n>6e5&&r.delete(t);if(r.size<=5e3)return;let t=r.size-5e3,n=Array.from(r.entries()).sort((e,t)=>e[1]-t[1]);for(let e=0;e<t;e++){let[t]=n[e]??[];if(!t)break;r.delete(t)}}function o(e){for(let[r,n]of t)e-n.markedAt>12096e5&&t.delete(r);if(t.size<=5e3)return;let r=t.size-5e3,n=Array.from(t.entries()).sort((e,t)=>e[1].lastSeenAt-t[1].lastSeenAt);for(let e=0;e<r;e++){let[r]=n[e]??[];if(!r)break;t.delete(r)}}function i(e,r=Date.now()){let n=t.get(e);t.set(e,{markedAt:n?.markedAt??r,lastSeenAt:r}),o(r)}function s(e){t.delete(e)}function a(e,t=Date.now()){r.set(e,t),n(t)}function l(e){r.delete(e)}function u(e,t=Date.now()){let n=r.get(e);return"number"==typeof n&&(t-n>6e5?(r.delete(e),!1):(r.delete(e),!0))}function d(e=Date.now()){n(e)}function c(e,r=Date.now()){let n=t.get(e);return!!n&&(r-n.markedAt>12096e5?(t.delete(e),!1):(t.set(e,{...n,lastSeenAt:r}),!0))}function p(e=Date.now()){o(e)}e.s(["clearSessionForceUnarchived",()=>s,"clearSessionStickyStatusBlocked",()=>l,"markSessionForceUnarchived",()=>i,"markSessionStickyStatusBlocked",()=>a,"pruneSessionForceUnarchived",()=>p,"pruneSessionStickyStatusBlocked",()=>d,"shouldForceSessionUnarchived",()=>c,"takeSessionStickyStatusBlocked",()=>u])},12080,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),i=e.i(61916),s=e.i(74677),a=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),m=e.i(10372),v=e.i(93695);e.i(52474);var w=e.i(220),x=e.i(99686),y=e.i(586),g=e.i(74579);async function R(e,{params:t}){let{id:r}=await t,n=function(e){if(!e.includes(":"))return e;try{let{hostId:t,sessionId:r}=(0,y.parseSourceKey)(e);return"local"===t?r:null}catch{return null}}(r);if(!n)return Response.json({error:"Session not found"},{status:404});let{ports:o,timedOut:i}=(0,x.discoverOpencodePortsWithMeta)();if(!o.length)return i?Response.json({error:"OpenCode discovery timed out"},{status:503}):Response.json({error:"OpenCode server not found"},{status:503});for(let e of o)try{let t=`http://localhost:${e}`,r=await fetch(`${t}/session/${n}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({time:{archived:Date.now()}})});if(r.ok)return(0,g.clearSessionForceUnarchived)(n),(0,g.markSessionStickyStatusBlocked)(n),Response.json({success:!0});console.error(`Failed to archive session on port ${e}:`,await r.text())}catch(t){console.error(`Failed to archive session on port ${e}:`,t)}return Response.json({error:"Session not found"},{status:404})}e.s(["POST",()=>R],844);var S=e.i(844);let E=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/archive/route",pathname:"/api/sessions/[id]/archive",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/sessions/[id]/archive/route.ts",nextConfigOutput:"standalone",userland:S}),{workAsyncStorage:b,workUnitAsyncStorage:C,serverHooks:O}=E;function A(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:C})}async function k(e,t,n){E.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/sessions/[id]/archive/route";x=x.replace(/\/index$/,"")||"/";let y=await E.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:g,params:R,nextConfig:S,parsedUrl:b,isDraftMode:C,prerenderManifest:O,routerServerContext:A,isOnDemandRevalidate:k,revalidateOnlyGenerated:I,resolvedPathname:T,clientReferenceManifest:N,serverActionsManifest:P}=y,M=(0,a.normalizeAppPath)(x),D=!!(O.dynamicRoutes[M]||O.routes[T]),_=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,b,!1):t.end("This page could not be found"),null);if(D&&!C){let e=!!O.routes[T],t=O.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(S.experimental.adapterPath)return await _();throw new v.NoFallbackError}}let U=null;!D||E.isDev||C||(U="/index"===(U=T)?"/":U);let j=!0===E.isDev||!D,q=D&&!j;P&&N&&(0,s.setManifestsSingleton)({page:x,clientReferenceManifest:N,serverActionsManifest:P});let F=e.method||"GET",$=(0,i.getTracer)(),H=$.getActiveScopeSpan(),K={params:R,prerenderManifest:O,renderOpts:{experimental:{authInterrupts:!!S.experimental.authInterrupts},cacheComponents:!!S.cacheComponents,supportsDynamicResponse:j,incrementalCache:(0,o.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:S.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,o)=>E.onRequestError(e,t,n,o,A)},sharedContext:{buildId:g}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),W=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let s=async e=>E.handle(W,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")!==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 n=r.get("next.route");if(n){let t=`${F} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${F} ${x}`)}),a=!!(0,o.getRequestMeta)(e,"minimalMode"),l=async o=>{var i,l;let u=async({previousCacheEntry:r})=>{try{if(!a&&k&&I&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(o);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let u=K.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(B,L,i,K.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(i.headers);u&&(t[m.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>=m.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,n=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:w.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:q,isOnDemandRevalidate:k})},!1,A),t}},d=await E.handleResponse({req:e,nextConfig:S,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:I,responseGenerator:u,waitUntil:n.waitUntil,isMinimalMode:a});if(!D)return null;if((null==d||null==(i=d.value)?void 0:i.kind)!==w.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});a||t.setHeader("x-nextjs-cache",k?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let v=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return a&&D||v.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||v.get("Cache-Control")||v.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(B,L,new Response(d.value.body,{headers:v,status:d.value.status||200})),null};H?await l(H):await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${F} ${x}`,kind:i.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},l))}catch(t){if(t instanceof v.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:q,isOnDemandRevalidate:k})},!1,A),D)throw t;return await (0,p.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>k,"patchFetch",()=>A,"routeModule",()=>E,"serverHooks",()=>O,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>C],12080)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__1e118bd3._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/opencodeDiscovery.ts","../../../src/lib/hostIdentity.ts","../../../src/lib/sessionArchiveOverrides.ts","../../../src/app/api/sessions/%5Bid%5D/archive/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { execSync } from 'child_process';\n\nconst DEFAULT_DISCOVERY_COMMAND_TIMEOUT_MS = 5000;\nconst knownPorts = new Set<number>();\n\nexport type OpencodeProcessCwd = {\n pid: number;\n cwd: string;\n};\n\nexport type OpencodePortDiscoveryResult = {\n ports: number[];\n timedOut: boolean;\n};\n\nexport type OpencodeProcessCwdDiscoveryResult = {\n processes: OpencodeProcessCwd[];\n timedOut: boolean;\n};\n\ntype DiscoveryState = {\n timedOut: boolean;\n timeoutMs: number;\n deadlineMs: number;\n};\n\nfunction getDiscoveryCommandTimeoutMs(): number {\n const parsedTimeout = Number(process.env.OPENCODE_DISCOVERY_TIMEOUT_MS);\n return Number.isFinite(parsedTimeout) && parsedTimeout > 0\n ? parsedTimeout\n : DEFAULT_DISCOVERY_COMMAND_TIMEOUT_MS;\n}\n\nfunction isCommandTimeoutError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n type TimeoutLikeError = Error & {\n code?: string;\n signal?: string;\n killed?: boolean;\n };\n\n const timeoutError = error as TimeoutLikeError;\n const message = timeoutError.message.toLowerCase();\n return timeoutError.code === 'ETIMEDOUT' || message.includes('timed out') || message.includes('etimedout');\n}\n\nfunction getRemainingTimeoutMs(state: DiscoveryState): number | null {\n const remainingMs = state.deadlineMs - Date.now();\n if (remainingMs <= 0) {\n state.timedOut = true;\n return null;\n }\n\n return Math.max(1, Math.min(state.timeoutMs, remainingMs));\n}\n\nfunction toUniqueSortedPorts(ports: number[]): number[] {\n return Array.from(\n new Set(ports.filter((port) => Number.isInteger(port) && port > 0 && port <= 65535))\n ).sort((a, b) => a - b);\n}\n\nfunction getPortsFromLsof(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('lsof -nP -iTCP -sTCP:LISTEN', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n const lines = output.split('\\n');\n const ports: number[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('COMMAND')) {\n continue;\n }\n\n const parts = trimmed.split(/\\s+/);\n const command = parts[0]?.toLowerCase();\n if (command !== 'opencode') {\n continue;\n }\n\n const match = trimmed.match(/:(\\d+)\\s+\\(LISTEN\\)/);\n if (!match) {\n continue;\n }\n\n const port = parseInt(match[1], 10);\n if (Number.isFinite(port)) {\n ports.push(port);\n }\n }\n\n return ports;\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nfunction getPortsFromProcessArgs(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('ps -axo command', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n const matches = [...output.matchAll(/\\bopencode\\b[^\\n]*\\b--port(?:=|\\s+)(\\d+)\\b/g)];\n return matches\n .map((match) => parseInt(match[1], 10))\n .filter((port) => Number.isFinite(port));\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nexport function discoverOpencodePorts(): number[] {\n return discoverOpencodePortsWithMeta().ports;\n}\n\nexport function discoverOpencodePortsWithMeta(): OpencodePortDiscoveryResult {\n const timeoutMs = getDiscoveryCommandTimeoutMs();\n const state: DiscoveryState = {\n timedOut: false,\n timeoutMs,\n deadlineMs: Date.now() + timeoutMs,\n };\n\n const discoveredPorts = toUniqueSortedPorts([\n ...getPortsFromLsof(state),\n ...getPortsFromProcessArgs(state),\n ]);\n\n for (const port of discoveredPorts) {\n knownPorts.add(port);\n }\n\n const ports = toUniqueSortedPorts([\n ...discoveredPorts,\n ...Array.from(knownPorts),\n ]);\n\n return {\n ports,\n timedOut: state.timedOut,\n };\n}\n\nfunction getOpencodePidsWithoutPortFlag(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('ps -axo pid=,command=', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n\n const pids: number[] = [];\n const lines = output.split('\\n');\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n\n const match = trimmed.match(/^(\\d+)\\s+(.+)$/);\n if (!match) continue;\n\n const pid = parseInt(match[1], 10);\n const command = match[2];\n\n if (!Number.isFinite(pid)) continue;\n if (!/\\bopencode\\b/.test(command)) continue;\n if (/\\b--port(?:=|\\s+)\\d+\\b/.test(command)) continue;\n\n pids.push(pid);\n }\n\n return Array.from(new Set(pids));\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nfunction getCwdForPid(pid: number, state: DiscoveryState): string | null {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return null;\n }\n\n const output = execSync(`lsof -nP -a -p ${pid} -d cwd -Fn`, {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n\n const cwdLine = output\n .split('\\n')\n .find((line) => line.startsWith('n') && line.length > 1);\n\n if (!cwdLine) return null;\n return cwdLine.slice(1);\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return null;\n }\n}\n\nexport function discoverOpencodeProcessCwdsWithoutPort(): OpencodeProcessCwd[] {\n return discoverOpencodeProcessCwdsWithoutPortWithMeta().processes;\n}\n\nexport function discoverOpencodeProcessCwdsWithoutPortWithMeta(): OpencodeProcessCwdDiscoveryResult {\n const timeoutMs = getDiscoveryCommandTimeoutMs();\n const state: DiscoveryState = {\n timedOut: false,\n timeoutMs,\n deadlineMs: Date.now() + timeoutMs,\n };\n\n const pids = getOpencodePidsWithoutPortFlag(state);\n if (!pids.length) {\n return {\n processes: [],\n timedOut: state.timedOut,\n };\n }\n\n const processes: OpencodeProcessCwd[] = [];\n const seen = new Set<string>();\n\n for (const pid of pids) {\n const cwd = getCwdForPid(pid, state);\n if (!cwd) continue;\n\n const key = `${pid}:${cwd}`;\n if (seen.has(key)) continue;\n seen.add(key);\n processes.push({ pid, cwd });\n }\n\n return {\n processes,\n timedOut: state.timedOut,\n };\n}\n","/**\n * Composes a composite source key from host ID and session ID.\n * Format: \"hostId:sessionId\"\n */\nexport function composeSourceKey(hostId: string, sessionId: string): string {\n if (!hostId || hostId.trim() === '') {\n throw new Error('Invalid hostId: cannot be empty');\n }\n if (!sessionId || sessionId.trim() === '') {\n throw new Error('Invalid sessionId: cannot be empty');\n }\n if (hostId.includes(':') || sessionId.includes(':')) {\n throw new Error('Invalid hostId or sessionId: colon character not allowed');\n }\n return `${hostId}:${sessionId}`;\n}\n\n/**\n * Parses a composite source key into host ID and session ID.\n * Throws if the key is not in the format \"hostId:sessionId\".\n */\nexport function parseSourceKey(sourceKey: string): { hostId: string; sessionId: string } {\n if (typeof sourceKey !== 'string') {\n throw new Error('Invalid sourceKey: must be a string');\n }\n\n const parts = sourceKey.split(':');\n if (parts.length !== 2) {\n throw new Error('Invalid sourceKey: must contain exactly one colon separator');\n }\n\n const [hostId, sessionId] = parts;\n const trimmedHostId = hostId.trim();\n const trimmedSessionId = sessionId.trim();\n if (trimmedHostId === '' || trimmedSessionId === '') {\n throw new Error('Invalid sourceKey: hostId and sessionId cannot be empty');\n }\n\n return { hostId: trimmedHostId, sessionId: trimmedSessionId };\n}\n\n/**\n * Extracts the host ID from a composite source key.\n * Returns null if the key is invalid.\n */\nexport function getHostIdFromSourceKey(sourceKey: string): string | null {\n try {\n const { hostId } = parseSourceKey(sourceKey);\n return hostId;\n } catch {\n return null;\n }\n}\n\n/**\n * Extracts the session ID from a composite source key.\n * Returns null if the key is invalid.\n */\nexport function getSessionIdFromSourceKey(sourceKey: string): string | null {\n try {\n const { sessionId } = parseSourceKey(sourceKey);\n return sessionId;\n } catch {\n return null;\n }\n}\n\n/**\n * Builds a composite source key from a host ID and session ID.\n */\nexport function buildSourceKey(hostId: string, sessionId: string): string {\n return composeSourceKey(hostId, sessionId);\n}\n\n/**\n * Checks if a source key matches a given host ID.\n */\nexport function isFromHost(sourceKey: string, hostId: string): boolean {\n const parsedHostId = getHostIdFromSourceKey(sourceKey);\n return parsedHostId === hostId;\n}\n","const FORCE_UNARCHIVE_RETENTION_MS = 14 * 24 * 60 * 60 * 1000;\nconst STICKY_STATUS_BLOCK_RETENTION_MS = 10 * 60 * 1000;\nconst MAX_FORCE_UNARCHIVE_ENTRIES = 5000;\n\ntype ForceUnarchiveEntry = {\n markedAt: number;\n lastSeenAt: number;\n};\n\nconst forceUnarchivedSessionIds = new Map<string, ForceUnarchiveEntry>();\nconst stickyStatusBlockedSessionIds = new Map<string, number>();\n\nfunction evictStickyStatusBlocks(now: number): void {\n for (const [sessionId, markedAt] of stickyStatusBlockedSessionIds) {\n if (now - markedAt > STICKY_STATUS_BLOCK_RETENTION_MS) {\n stickyStatusBlockedSessionIds.delete(sessionId);\n }\n }\n\n if (stickyStatusBlockedSessionIds.size <= MAX_FORCE_UNARCHIVE_ENTRIES) {\n return;\n }\n\n const overflow = stickyStatusBlockedSessionIds.size - MAX_FORCE_UNARCHIVE_ENTRIES;\n const oldest = Array.from(stickyStatusBlockedSessionIds.entries()).sort((a, b) => a[1] - b[1]);\n\n for (let i = 0; i < overflow; i++) {\n const [sessionId] = oldest[i] ?? [];\n if (!sessionId) break;\n stickyStatusBlockedSessionIds.delete(sessionId);\n }\n}\n\nfunction evictStale(now: number): void {\n for (const [sessionId, entry] of forceUnarchivedSessionIds) {\n if (now - entry.markedAt > FORCE_UNARCHIVE_RETENTION_MS) {\n forceUnarchivedSessionIds.delete(sessionId);\n }\n }\n\n if (forceUnarchivedSessionIds.size <= MAX_FORCE_UNARCHIVE_ENTRIES) {\n return;\n }\n\n const overflow = forceUnarchivedSessionIds.size - MAX_FORCE_UNARCHIVE_ENTRIES;\n const oldestByLastSeen = Array.from(forceUnarchivedSessionIds.entries()).sort(\n (a, b) => a[1].lastSeenAt - b[1].lastSeenAt\n );\n\n for (let i = 0; i < overflow; i++) {\n const [sessionId] = oldestByLastSeen[i] ?? [];\n if (!sessionId) break;\n forceUnarchivedSessionIds.delete(sessionId);\n }\n}\n\nexport function markSessionForceUnarchived(sessionId: string, now: number = Date.now()): void {\n const current = forceUnarchivedSessionIds.get(sessionId);\n forceUnarchivedSessionIds.set(sessionId, {\n markedAt: current?.markedAt ?? now,\n lastSeenAt: now,\n });\n evictStale(now);\n}\n\nexport function clearSessionForceUnarchived(sessionId: string): void {\n forceUnarchivedSessionIds.delete(sessionId);\n}\n\nexport function markSessionStickyStatusBlocked(sessionId: string, now: number = Date.now()): void {\n stickyStatusBlockedSessionIds.set(sessionId, now);\n evictStickyStatusBlocks(now);\n}\n\nexport function clearSessionStickyStatusBlocked(sessionId: string): void {\n stickyStatusBlockedSessionIds.delete(sessionId);\n}\n\nexport function takeSessionStickyStatusBlocked(sessionId: string, now: number = Date.now()): boolean {\n const markedAt = stickyStatusBlockedSessionIds.get(sessionId);\n if (typeof markedAt !== 'number') {\n return false;\n }\n\n if (now - markedAt > STICKY_STATUS_BLOCK_RETENTION_MS) {\n stickyStatusBlockedSessionIds.delete(sessionId);\n return false;\n }\n\n stickyStatusBlockedSessionIds.delete(sessionId);\n return true;\n}\n\nexport function pruneSessionStickyStatusBlocked(now: number = Date.now()): void {\n evictStickyStatusBlocks(now);\n}\n\nexport function shouldForceSessionUnarchived(sessionId: string, now: number = Date.now()): boolean {\n const entry = forceUnarchivedSessionIds.get(sessionId);\n if (!entry) return false;\n\n if (now - entry.markedAt > FORCE_UNARCHIVE_RETENTION_MS) {\n forceUnarchivedSessionIds.delete(sessionId);\n return false;\n }\n\n forceUnarchivedSessionIds.set(sessionId, {\n ...entry,\n lastSeenAt: now,\n });\n return true;\n}\n\nexport function pruneSessionForceUnarchived(now: number = Date.now()): void {\n evictStale(now);\n}\n","import { discoverOpencodePortsWithMeta } from '@/lib/opencodeDiscovery';\nimport { parseSourceKey } from '@/lib/hostIdentity';\nimport {\n clearSessionForceUnarchived,\n markSessionStickyStatusBlocked,\n} from '@/lib/sessionArchiveOverrides';\n\nfunction resolveLocalSessionId(id: string): string | null {\n if (!id.includes(':')) {\n return id;\n }\n\n try {\n const { hostId, sessionId } = parseSourceKey(id);\n return hostId === 'local' ? sessionId : null;\n } catch {\n return null;\n }\n}\n\nexport async function POST(_: Request, { params }: { params: Promise<{ id: string }> }) {\n const { id } = await params;\n const sessionId = resolveLocalSessionId(id);\n\n if (!sessionId) {\n return Response.json(\n { error: 'Session not found' },\n { status: 404 }\n );\n }\n\n const { ports, timedOut } = discoverOpencodePortsWithMeta();\n if (!ports.length) {\n if (timedOut) {\n return Response.json(\n { error: 'OpenCode discovery timed out' },\n { status: 503 }\n );\n }\n\n return Response.json(\n { error: 'OpenCode server not found' },\n { status: 503 }\n );\n }\n for (const port of ports) {\n try {\n const baseUrl = `http://localhost:${port}`;\n const response = await fetch(`${baseUrl}/session/${sessionId}`, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({ time: { archived: Date.now() } })\n });\n if (response.ok) {\n clearSessionForceUnarchived(sessionId);\n markSessionStickyStatusBlocked(sessionId);\n return Response.json({ success: true });\n }\n console.error(`Failed to archive session on port ${port}:`, await response.text());\n } catch (error) {\n console.error(`Failed to archive session on port ${port}:`, error);\n }\n }\n\n return Response.json(\n { error: 'Session not found' },\n { status: 404 }\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 = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sessions/[id]/archive/route\",\n pathname: \"/api/sessions/[id]/archive\",\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/sessions/[id]/archive/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/sessions/[id]/archive/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":"64BAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAGA,IAAM,EAAa,IAAI,IAuBvB,SAAS,IACP,IAAM,EAAgB,OAAO,QAAQ,GAAG,CAAC,6BAA6B,EACtE,OAAO,OAAO,QAAQ,CAAC,IAAkB,EAAgB,EACrD,EA3BuC,GA6B7C,CAEA,SAAS,CAHH,CAGyB,CAAc,EAC3C,GAAI,CAAC,CAAC,aAAiB,KAAA,CAAK,CAC1B,EAD6B,KACtB,EAUT,IAAM,EAAU,EAAa,OAAO,CAAC,WAAW,GAChD,MAA6B,cAAtB,AAFc,EAED,IAAI,EAAoB,EAAQ,QAAQ,CAAC,cAAgB,EAAQ,QAAQ,CAAC,YAChG,CAEA,SAAS,EAAsB,CAAqB,EAClD,IAAM,EAAc,EAAM,UAAU,CAAG,KAAK,GAAG,UAC/C,AAAI,GAAe,GAAG,AACpB,EAAM,QAAQ,EAAG,EACV,MAGF,KAAK,GAAG,CAAC,EAAG,KAAK,GAAG,CAAC,EAAM,SAAS,CAAE,GAC/C,CAEA,SAAS,EAAoB,CAAe,EAC1C,OAAO,MAAM,IAAI,CACf,IAAI,IAAI,EAAM,MAAM,CAAC,AAAC,GAAS,OAAO,SAAS,CAAC,IAAS,EAAO,GAAK,GAAQ,SAC7E,IAAI,CAAC,CAAC,EAAG,IAAM,EAAI,EACvB,CA6EO,SAAS,IACd,IAAM,EAAY,IACZ,EAAwB,CAC5B,UAAU,EACV,YACA,WAAY,KAAK,GAAG,GAAK,CAC3B,EAEM,EAAkB,EAAoB,IACvC,AApFP,SA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AAC,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":[4]}
@@ -1,3 +1,3 @@
1
- module.exports=[24725,(e,r,t)=>{r.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"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},32319,(e,r,t)=>{r.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"))},18622,(e,r,t)=>{r.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,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))}];
1
+ module.exports=[24725,(e,r,t)=>{r.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"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},32319,(e,r,t)=>{r.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"))},18622,(e,r,t)=>{r.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,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,r,t)=>{r.exports=e.x("path",()=>require("path"))},57181,e=>{"use strict";var r=e.i(24868),t=e.i(22734),n=e.i(14747),s=e.i(46786),i=e.i(89196);let a=(0,n.join)((0,s.homedir)(),".config","opencode"),o=(0,n.join)(a,"oh-my-opencode.jsonc"),p="https://opencode.ai/config.json";function x(e=o){try{return(0,t.existsSync)(e)}catch{return!1}}async function c(e=o){try{let t=await (0,r.readFile)(e,"utf-8");return(0,i.parse)(t,null,!1)}catch{return{}}}async function d(e,s=o){try{let a=(0,n.join)(s,"..");(0,t.existsSync)(a)||(0,t.mkdirSync)(a,{recursive:!0});let x=s===o?{...e,$schema:e.$schema||p}:e,c=(0,i.stringify)(x,null,2);await (0,r.writeFile)(s,c,"utf-8")}catch(e){throw Error(`Failed to write config: ${e}`)}}e.s(["CONFIG_PATH",0,o,"OPEN_CODE_CONFIG_SCHEMA",0,p,"detectConfig",()=>x,"readConfig",()=>c,"writeConfig",()=>d])}];
2
2
 
3
- //# sourceMappingURL=%5Bexternals%5D_next_dist_16542d6b._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__56690af0._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/opencodeConfig.ts"],"sourcesContent":["import { readFile, writeFile } from 'fs/promises';\nimport { existsSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { parse, stringify } from 'comment-json';\n\nexport const CONFIG_DIR = join(homedir(), '.config', 'opencode');\nexport const CONFIG_PATH = join(CONFIG_DIR, 'oh-my-opencode.jsonc');\nexport const OPEN_CODE_CONFIG_SCHEMA = 'https://opencode.ai/config.json';\n\nexport type OpenCodeConfig = {\n $schema?: string;\n agents?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\nexport function detectConfig(configPath: string = CONFIG_PATH): boolean {\n try {\n return existsSync(configPath);\n } catch {\n return false;\n }\n}\n\nexport async function readConfig(configPath: string = CONFIG_PATH): Promise<OpenCodeConfig> {\n try {\n const content = await readFile(configPath, 'utf-8');\n const config = parse(content, null, false) as OpenCodeConfig;\n return config;\n } catch {\n return {};\n }\n}\n\nexport async function writeConfig(\n config: OpenCodeConfig, \n configPath: string = CONFIG_PATH\n): Promise<void> {\n try {\n const configDir = join(configPath, '..');\n if (!existsSync(configDir)) {\n mkdirSync(configDir, { recursive: true });\n }\n\n const shouldEnforceSchema = configPath === CONFIG_PATH;\n const configWithSchema: OpenCodeConfig = shouldEnforceSchema\n ? {\n ...config,\n $schema: config.$schema || OPEN_CODE_CONFIG_SCHEMA,\n }\n : config;\n\n const content = stringify(configWithSchema, null, 2);\n await writeFile(configPath, content, 'utf-8');\n } catch (error) {\n throw new Error(`Failed to write config: ${error}`);\n }\n}\n"],"names":[],"mappings":"8iCAAA,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,OAEO,IAAM,EAAa,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,UAAW,YACxC,EAAc,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAY,wBASrC,SAAS,EAAa,EAAqB,CAAW,EAC3D,GAAI,CACF,MAAO,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,EACpB,CAAE,KAAM,CACN,MAAO,EACT,CACF,CAEO,eAAe,EAAW,EAAqB,CAAW,EAC/D,GAAI,CACF,IAAM,EAAU,MAAM,CAAA,EAAA,EAAA,QAAA,AAAQ,EAAC,EAAY,SAE3C,MADe,CAAA,AACR,EADQ,EAAA,KAAA,AAAK,EAAC,EAAS,MAAM,EAEtC,CAAE,KAAM,CACN,MAAO,CAAC,CACV,CACF,CAEO,eAAe,EACpB,CAAsB,CACtB,EAAqB,CAAW,EAEhC,GAAI,CACF,IAAM,EAAY,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAY,KAC/B,CAAC,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,IACd,CAAA,EAAA,EAAA,GAD0B,MAC1B,AAAS,EAAC,EAAW,CAAE,WAAW,CAAK,GAIzC,IAAM,EADsB,AACa,IADE,EAEvC,CACE,GAAG,CAAM,CACT,QAAS,EAAO,OAAO,EAxCM,EAwCF,+BAC7B,EACA,EAEE,EAAU,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,EAAkB,KAAM,EAClD,OAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,EAAY,EAAS,QACvC,CAAE,MAAO,EAAO,CACd,MAAM,AAAI,MAAM,CAAC,wBAAwB,EAAE,EAAA,CAAO,CACpD,CACF"}
1
+ {"version":3,"sources":["../../../src/lib/opencodeConfig.ts"],"sourcesContent":["import { readFile, writeFile } from 'fs/promises';\nimport { existsSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { parse, stringify } from 'comment-json';\n\nexport const CONFIG_DIR = join(homedir(), '.config', 'opencode');\nexport const CONFIG_PATH = join(CONFIG_DIR, 'oh-my-opencode.jsonc');\nexport const OPEN_CODE_CONFIG_SCHEMA = 'https://opencode.ai/config.json';\n\nexport type OpenCodeConfig = {\n $schema?: string;\n agents?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\nexport function detectConfig(configPath: string = CONFIG_PATH): boolean {\n try {\n return existsSync(configPath);\n } catch {\n return false;\n }\n}\n\nexport async function readConfig(configPath: string = CONFIG_PATH): Promise<OpenCodeConfig> {\n try {\n const content = await readFile(configPath, 'utf-8');\n const config = parse(content, null, false) as OpenCodeConfig;\n return config;\n } catch {\n return {};\n }\n}\n\nexport async function writeConfig(\n config: OpenCodeConfig, \n configPath: string = CONFIG_PATH\n): Promise<void> {\n try {\n const configDir = join(configPath, '..');\n if (!existsSync(configDir)) {\n mkdirSync(configDir, { recursive: true });\n }\n\n const shouldEnforceSchema = configPath === CONFIG_PATH;\n const configWithSchema: OpenCodeConfig = shouldEnforceSchema\n ? {\n ...config,\n $schema: config.$schema || OPEN_CODE_CONFIG_SCHEMA,\n }\n : config;\n\n const content = stringify(configWithSchema, null, 2);\n await writeFile(configPath, content, 'utf-8');\n } catch (error) {\n throw new Error(`Failed to write config: ${error}`);\n }\n}\n"],"names":[],"mappings":"8iCAAA,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,OAEO,IAAM,EAAa,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,CAAA,EAAA,EAAA,OAAA,AAAO,IAAI,UAAW,YACxC,EAAc,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAY,wBAC/B,EAA0B,kCAQhC,SAAS,EAAa,EAAqB,CAAW,EAC3D,GAAI,CACF,MAAO,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,EACpB,CAAE,KAAM,CACN,OAAO,CACT,CACF,CAEO,eAAe,EAAW,EAAqB,CAAW,EAC/D,GAAI,CACF,IAAM,EAAU,MAAM,CAAA,EAAA,EAAA,QAAA,AAAQ,EAAC,EAAY,SAE3C,MADe,CAAA,AACR,EADQ,EAAA,KAAA,AAAK,EAAC,EAAS,MAAM,EAEtC,CAAE,KAAM,CACN,MAAO,CAAC,CACV,CACF,CAEO,eAAe,EACpB,CAAsB,CACtB,EAAqB,CAAW,EAEhC,GAAI,CACF,IAAM,EAAY,CAAA,EAAA,EAAA,IAAA,AAAI,EAAC,EAAY,KAC/B,CAAC,CAAA,EAAA,EAAA,UAAA,AAAU,EAAC,IACd,CAAA,EAAA,EAAA,GAD0B,MAC1B,AAAS,EAAC,EAAW,CAAE,WAAW,CAAK,GAIzC,IAAM,EADsB,AACa,IADE,EAEvC,CACE,GAAG,CAAM,CACT,QAAS,EAAO,OAAO,EAAI,CAC7B,EACA,EAEE,EAAU,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,EAAkB,KAAM,EAClD,OAAM,CAAA,EAAA,EAAA,SAAA,AAAS,EAAC,EAAY,EAAS,QACvC,CAAE,MAAO,EAAO,CACd,MAAM,AAAI,MAAM,CAAC,wBAAwB,EAAE,EAAA,CAAO,CACpD,CACF"}
@@ -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"))},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"))},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"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},99686,e=>{"use strict";var t=e.i(33405);let r=new Set;function n(){let e=Number(process.env.OPENCODE_DISCOVERY_TIMEOUT_MS);return Number.isFinite(e)&&e>0?e:5e3}function o(e){if(!(e instanceof Error))return!1;let t=e.message.toLowerCase();return"ETIMEDOUT"===e.code||t.includes("timed out")||t.includes("etimedout")}function i(e){let t=e.deadlineMs-Date.now();return t<=0?(e.timedOut=!0,null):Math.max(1,Math.min(e.timeoutMs,t))}function s(e){return Array.from(new Set(e.filter(e=>Number.isInteger(e)&&e>0&&e<=65535))).sort((e,t)=>e-t)}function a(){let e=n(),a={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},l=s([...function(e){try{let r=i(e);if(null===r)return[];let n=(0,t.execSync)("lsof -nP -iTCP -sTCP:LISTEN",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}).split("\n"),o=[];for(let e of n){let t=e.trim();if(!t||t.startsWith("COMMAND"))continue;let r=t.split(/\s+/),n=r[0]?.toLowerCase();if("opencode"!==n)continue;let i=t.match(/:(\d+)\s+\(LISTEN\)/);if(!i)continue;let s=parseInt(i[1],10);Number.isFinite(s)&&o.push(s)}return o}catch(t){return o(t)&&(e.timedOut=!0),[]}}(a),...function(e){try{let r=i(e);if(null===r)return[];return[...(0,t.execSync)("ps -axo command",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}).matchAll(/\bopencode\b[^\n]*\b--port(?:=|\s+)(\d+)\b/g)].map(e=>parseInt(e[1],10)).filter(e=>Number.isFinite(e))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(a)]);for(let e of l)r.add(e);return{ports:s([...l,...Array.from(r)]),timedOut:a.timedOut}}function l(){let e=n(),r={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},s=function(e){try{let r=i(e);if(null===r)return[];let n=(0,t.execSync)("ps -axo pid=,command=",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}),o=[];for(let e of n.split("\n")){let t=e.trim();if(!t)continue;let r=t.match(/^(\d+)\s+(.+)$/);if(!r)continue;let n=parseInt(r[1],10),i=r[2];Number.isFinite(n)&&/\bopencode\b/.test(i)&&(/\b--port(?:=|\s+)\d+\b/.test(i)||o.push(n))}return Array.from(new Set(o))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(r);if(!s.length)return{processes:[],timedOut:r.timedOut};let a=[],l=new Set;for(let e of s){let n=function(e,r){try{let n=i(r);if(null===n)return null;let o=(0,t.execSync)(`lsof -nP -a -p ${e} -d cwd -Fn`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:n}).split("\n").find(e=>e.startsWith("n")&&e.length>1);if(!o)return null;return o.slice(1)}catch(e){return o(e)&&(r.timedOut=!0),null}}(e,r);if(!n)continue;let s=`${e}:${n}`;l.has(s)||(l.add(s),a.push({pid:e,cwd:n}))}return{processes:a,timedOut:r.timedOut}}e.s(["discoverOpencodePortsWithMeta",()=>a,"discoverOpencodeProcessCwdsWithoutPortWithMeta",()=>l])},586,e=>{"use strict";function t(e,t){if(!e||""===e.trim())throw Error("Invalid hostId: cannot be empty");if(!t||""===t.trim())throw Error("Invalid sessionId: cannot be empty");if(e.includes(":")||t.includes(":"))throw Error("Invalid hostId or sessionId: colon character not allowed");return`${e}:${t}`}function r(e){if("string"!=typeof e)throw Error("Invalid sourceKey: must be a string");let t=e.split(":");if(2!==t.length)throw Error("Invalid sourceKey: must contain exactly one colon separator");let[r,n]=t,o=r.trim(),i=n.trim();if(""===o||""===i)throw Error("Invalid sourceKey: hostId and sessionId cannot be empty");return{hostId:o,sessionId:i}}e.s(["composeSourceKey",()=>t,"parseSourceKey",()=>r])},96279,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),i=e.i(61916),s=e.i(74677),a=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),f=e.i(26937),m=e.i(10372),x=e.i(93695);e.i(52474);var g=e.i(220);e.i(39354);var v=e.i(34959),R=e.i(99686),E=e.i(586);async function w(e,{params:t}){let{id:r}=await t,n=function(e){if(!e.includes(":"))return e;try{let{hostId:t,sessionId:r}=(0,E.parseSourceKey)(e);return"local"===t?r:null}catch{return null}}(r);if(!n)return Response.json({error:"Session not found"},{status:404});let{ports:o,timedOut:i}=(0,R.discoverOpencodePortsWithMeta)();if(!o.length)return i?Response.json({error:"OpenCode discovery timed out",hint:"Host process discovery exceeded timeout. Retry shortly, or increase OPENCODE_DISCOVERY_TIMEOUT_MS."},{status:503}):Response.json({error:"OpenCode server not found",hint:"Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports)."},{status:503});try{for(let e of o)try{let t=(0,v.createOpencodeClient)({baseUrl:`http://localhost:${e}`}),r=await t.session.get({path:{id:n}});if(r.data)return Response.json({session:r.data})}catch{}return Response.json({error:"Session not found"},{status:404})}catch(e){return console.error("Error fetching session:",e),Response.json({error:"Failed to fetch session",details:e instanceof Error?e.message:String(e),hint:"Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports)."},{status:500})}}e.s(["GET",()=>w],13346);var y=e.i(13346);let O=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/route",pathname:"/api/sessions/[id]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/sessions/[id]/route.ts",nextConfigOutput:"standalone",userland:y}),{workAsyncStorage:C,workUnitAsyncStorage:b,serverHooks:I}=O;function P(){return(0,n.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:b})}async function S(e,t,n){O.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/sessions/[id]/route";v=v.replace(/\/index$/,"")||"/";let R=await O.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:E,params:w,nextConfig:y,parsedUrl:C,isDraftMode:b,prerenderManifest:I,routerServerContext:P,isOnDemandRevalidate:S,revalidateOnlyGenerated:T,resolvedPathname:A,clientReferenceManifest:N,serverActionsManifest:M}=R,_=(0,a.normalizeAppPath)(v),D=!!(I.dynamicRoutes[_]||I.routes[A]),j=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,C,!1):t.end("This page could not be found"),null);if(D&&!b){let e=!!I.routes[A],t=I.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(y.experimental.adapterPath)return await j();throw new x.NoFallbackError}}let k=null;!D||O.isDev||b||(k="/index"===(k=A)?"/":k);let q=!0===O.isDev||!D,U=D&&!q;M&&N&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:N,serverActionsManifest:M});let H=e.method||"GET",$=(0,i.getTracer)(),F=$.getActiveScopeSpan(),K={params:w,prerenderManifest:I,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:q,incrementalCache:(0,o.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:y.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,o)=>O.onRequestError(e,t,n,o,P)},sharedContext:{buildId:E}},L=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),V=u.NextRequestAdapter.fromNodeNextRequest(L,(0,u.signalFromNodeResponse)(t));try{let s=async e=>O.handle(V,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")!==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 n=r.get("next.route");if(n){let t=`${H} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${H} ${v}`)}),a=!!(0,o.getRequestMeta)(e,"minimalMode"),l=async o=>{var i,l;let u=async({previousCacheEntry:r})=>{try{if(!a&&S&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(o);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let u=K.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(L,W,i,K.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(i.headers);u&&(t[m.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>=m.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,n=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await O.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:S})},!1,P),t}},d=await O.handleResponse({req:e,nextConfig:y,cacheKey:k,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:T,responseGenerator:u,waitUntil:n.waitUntil,isMinimalMode:a});if(!D)return null;if((null==d||null==(i=d.value)?void 0:i.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});a||t.setHeader("x-nextjs-cache",S?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return a&&D||x.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,f.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(L,W,new Response(d.value.body,{headers:x,status:d.value.status||200})),null};F?await l(F):await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${H} ${v}`,kind:i.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},l))}catch(t){if(t instanceof x.NoFallbackError||await O.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:S})},!1,P),D)throw t;return await (0,p.sendResponse)(L,W,new Response(null,{status:500})),null}}e.s(["handler",()=>S,"patchFetch",()=>P,"routeModule",()=>O,"serverHooks",()=>I,"workAsyncStorage",()=>C,"workUnitAsyncStorage",()=>b],96279)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__56f5f249._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/opencodeDiscovery.ts","../../../src/lib/hostIdentity.ts","../../../src/app/api/sessions/%5Bid%5D/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { execSync } from 'child_process';\n\nconst DEFAULT_DISCOVERY_COMMAND_TIMEOUT_MS = 5000;\nconst knownPorts = new Set<number>();\n\nexport type OpencodeProcessCwd = {\n pid: number;\n cwd: string;\n};\n\nexport type OpencodePortDiscoveryResult = {\n ports: number[];\n timedOut: boolean;\n};\n\nexport type OpencodeProcessCwdDiscoveryResult = {\n processes: OpencodeProcessCwd[];\n timedOut: boolean;\n};\n\ntype DiscoveryState = {\n timedOut: boolean;\n timeoutMs: number;\n deadlineMs: number;\n};\n\nfunction getDiscoveryCommandTimeoutMs(): number {\n const parsedTimeout = Number(process.env.OPENCODE_DISCOVERY_TIMEOUT_MS);\n return Number.isFinite(parsedTimeout) && parsedTimeout > 0\n ? parsedTimeout\n : DEFAULT_DISCOVERY_COMMAND_TIMEOUT_MS;\n}\n\nfunction isCommandTimeoutError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n type TimeoutLikeError = Error & {\n code?: string;\n signal?: string;\n killed?: boolean;\n };\n\n const timeoutError = error as TimeoutLikeError;\n const message = timeoutError.message.toLowerCase();\n return timeoutError.code === 'ETIMEDOUT' || message.includes('timed out') || message.includes('etimedout');\n}\n\nfunction getRemainingTimeoutMs(state: DiscoveryState): number | null {\n const remainingMs = state.deadlineMs - Date.now();\n if (remainingMs <= 0) {\n state.timedOut = true;\n return null;\n }\n\n return Math.max(1, Math.min(state.timeoutMs, remainingMs));\n}\n\nfunction toUniqueSortedPorts(ports: number[]): number[] {\n return Array.from(\n new Set(ports.filter((port) => Number.isInteger(port) && port > 0 && port <= 65535))\n ).sort((a, b) => a - b);\n}\n\nfunction getPortsFromLsof(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('lsof -nP -iTCP -sTCP:LISTEN', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n const lines = output.split('\\n');\n const ports: number[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('COMMAND')) {\n continue;\n }\n\n const parts = trimmed.split(/\\s+/);\n const command = parts[0]?.toLowerCase();\n if (command !== 'opencode') {\n continue;\n }\n\n const match = trimmed.match(/:(\\d+)\\s+\\(LISTEN\\)/);\n if (!match) {\n continue;\n }\n\n const port = parseInt(match[1], 10);\n if (Number.isFinite(port)) {\n ports.push(port);\n }\n }\n\n return ports;\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nfunction getPortsFromProcessArgs(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('ps -axo command', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n const matches = [...output.matchAll(/\\bopencode\\b[^\\n]*\\b--port(?:=|\\s+)(\\d+)\\b/g)];\n return matches\n .map((match) => parseInt(match[1], 10))\n .filter((port) => Number.isFinite(port));\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nexport function discoverOpencodePorts(): number[] {\n return discoverOpencodePortsWithMeta().ports;\n}\n\nexport function discoverOpencodePortsWithMeta(): OpencodePortDiscoveryResult {\n const timeoutMs = getDiscoveryCommandTimeoutMs();\n const state: DiscoveryState = {\n timedOut: false,\n timeoutMs,\n deadlineMs: Date.now() + timeoutMs,\n };\n\n const discoveredPorts = toUniqueSortedPorts([\n ...getPortsFromLsof(state),\n ...getPortsFromProcessArgs(state),\n ]);\n\n for (const port of discoveredPorts) {\n knownPorts.add(port);\n }\n\n const ports = toUniqueSortedPorts([\n ...discoveredPorts,\n ...Array.from(knownPorts),\n ]);\n\n return {\n ports,\n timedOut: state.timedOut,\n };\n}\n\nfunction getOpencodePidsWithoutPortFlag(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('ps -axo pid=,command=', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n\n const pids: number[] = [];\n const lines = output.split('\\n');\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n\n const match = trimmed.match(/^(\\d+)\\s+(.+)$/);\n if (!match) continue;\n\n const pid = parseInt(match[1], 10);\n const command = match[2];\n\n if (!Number.isFinite(pid)) continue;\n if (!/\\bopencode\\b/.test(command)) continue;\n if (/\\b--port(?:=|\\s+)\\d+\\b/.test(command)) continue;\n\n pids.push(pid);\n }\n\n return Array.from(new Set(pids));\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nfunction getCwdForPid(pid: number, state: DiscoveryState): string | null {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return null;\n }\n\n const output = execSync(`lsof -nP -a -p ${pid} -d cwd -Fn`, {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n\n const cwdLine = output\n .split('\\n')\n .find((line) => line.startsWith('n') && line.length > 1);\n\n if (!cwdLine) return null;\n return cwdLine.slice(1);\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return null;\n }\n}\n\nexport function discoverOpencodeProcessCwdsWithoutPort(): OpencodeProcessCwd[] {\n return discoverOpencodeProcessCwdsWithoutPortWithMeta().processes;\n}\n\nexport function discoverOpencodeProcessCwdsWithoutPortWithMeta(): OpencodeProcessCwdDiscoveryResult {\n const timeoutMs = getDiscoveryCommandTimeoutMs();\n const state: DiscoveryState = {\n timedOut: false,\n timeoutMs,\n deadlineMs: Date.now() + timeoutMs,\n };\n\n const pids = getOpencodePidsWithoutPortFlag(state);\n if (!pids.length) {\n return {\n processes: [],\n timedOut: state.timedOut,\n };\n }\n\n const processes: OpencodeProcessCwd[] = [];\n const seen = new Set<string>();\n\n for (const pid of pids) {\n const cwd = getCwdForPid(pid, state);\n if (!cwd) continue;\n\n const key = `${pid}:${cwd}`;\n if (seen.has(key)) continue;\n seen.add(key);\n processes.push({ pid, cwd });\n }\n\n return {\n processes,\n timedOut: state.timedOut,\n };\n}\n","/**\n * Composes a composite source key from host ID and session ID.\n * Format: \"hostId:sessionId\"\n */\nexport function composeSourceKey(hostId: string, sessionId: string): string {\n if (!hostId || hostId.trim() === '') {\n throw new Error('Invalid hostId: cannot be empty');\n }\n if (!sessionId || sessionId.trim() === '') {\n throw new Error('Invalid sessionId: cannot be empty');\n }\n if (hostId.includes(':') || sessionId.includes(':')) {\n throw new Error('Invalid hostId or sessionId: colon character not allowed');\n }\n return `${hostId}:${sessionId}`;\n}\n\n/**\n * Parses a composite source key into host ID and session ID.\n * Throws if the key is not in the format \"hostId:sessionId\".\n */\nexport function parseSourceKey(sourceKey: string): { hostId: string; sessionId: string } {\n if (typeof sourceKey !== 'string') {\n throw new Error('Invalid sourceKey: must be a string');\n }\n\n const parts = sourceKey.split(':');\n if (parts.length !== 2) {\n throw new Error('Invalid sourceKey: must contain exactly one colon separator');\n }\n\n const [hostId, sessionId] = parts;\n const trimmedHostId = hostId.trim();\n const trimmedSessionId = sessionId.trim();\n if (trimmedHostId === '' || trimmedSessionId === '') {\n throw new Error('Invalid sourceKey: hostId and sessionId cannot be empty');\n }\n\n return { hostId: trimmedHostId, sessionId: trimmedSessionId };\n}\n\n/**\n * Extracts the host ID from a composite source key.\n * Returns null if the key is invalid.\n */\nexport function getHostIdFromSourceKey(sourceKey: string): string | null {\n try {\n const { hostId } = parseSourceKey(sourceKey);\n return hostId;\n } catch {\n return null;\n }\n}\n\n/**\n * Extracts the session ID from a composite source key.\n * Returns null if the key is invalid.\n */\nexport function getSessionIdFromSourceKey(sourceKey: string): string | null {\n try {\n const { sessionId } = parseSourceKey(sourceKey);\n return sessionId;\n } catch {\n return null;\n }\n}\n\n/**\n * Builds a composite source key from a host ID and session ID.\n */\nexport function buildSourceKey(hostId: string, sessionId: string): string {\n return composeSourceKey(hostId, sessionId);\n}\n\n/**\n * Checks if a source key matches a given host ID.\n */\nexport function isFromHost(sourceKey: string, hostId: string): boolean {\n const parsedHostId = getHostIdFromSourceKey(sourceKey);\n return parsedHostId === hostId;\n}\n","import { createOpencodeClient } from '@opencode-ai/sdk';\nimport { discoverOpencodePortsWithMeta } from '@/lib/opencodeDiscovery';\nimport { parseSourceKey } from '@/lib/hostIdentity';\n\nfunction resolveLocalSessionId(id: string): string | null {\n if (!id.includes(':')) {\n return id;\n }\n\n try {\n const { hostId, sessionId } = parseSourceKey(id);\n return hostId === 'local' ? sessionId : null;\n } catch {\n return null;\n }\n}\n\nexport async function GET(\n _: Request,\n { params }: { params: Promise<{ id: string }> }\n) {\n const { id } = await params;\n const sessionId = resolveLocalSessionId(id);\n\n if (!sessionId) {\n return Response.json({ error: 'Session not found' }, { status: 404 });\n }\n\n const { ports, timedOut } = discoverOpencodePortsWithMeta();\n \n if (!ports.length) {\n if (timedOut) {\n return Response.json(\n {\n error: 'OpenCode discovery timed out',\n hint: 'Host process discovery exceeded timeout. Retry shortly, or increase OPENCODE_DISCOVERY_TIMEOUT_MS.'\n },\n { status: 503 }\n );\n }\n\n return Response.json(\n {\n error: 'OpenCode server not found',\n hint: 'Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports).'\n },\n { status: 503 }\n );\n }\n\n try {\n for (const port of ports) {\n try {\n const client = createOpencodeClient({ baseUrl: `http://localhost:${port}` });\n const result = await client.session.get({ path: { id: sessionId } });\n if (result.data) {\n return Response.json({ session: result.data });\n }\n } catch {\n // Try next port\n }\n }\n return Response.json({ error: 'Session not found' }, { status: 404 });\n } catch (error) {\n console.error('Error fetching session:', error);\n return Response.json(\n {\n error: 'Failed to fetch session',\n details: error instanceof Error ? error.message : String(error),\n hint: 'Make sure OpenCode is running with an exposed API port. Example: opencode --port <PORT> (VibePulse auto-detects active ports).'\n },\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 = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sessions/[id]/route\",\n pathname: \"/api/sessions/[id]\",\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/sessions/[id]/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/sessions/[id]/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":"64BAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAGA,IAAM,EAAa,IAAI,IAuBvB,SAAS,IACP,IAAM,EAAgB,OAAO,QAAQ,GAAG,CAAC,6BAA6B,EACtE,OAAO,OAAO,QAAQ,CAAC,IAAkB,EAAgB,EACrD,EA3BuC,GA6B7C,CAEA,SAAS,CAHH,CAGyB,CAAc,EAC3C,GAAI,CAAC,CAAC,aAAiB,KAAA,C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W,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":[3]}
@@ -0,0 +1,3 @@
1
+ module.exports=[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"))},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"))},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"))},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"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},57181,e=>{"use strict";var t=e.i(24868),r=e.i(22734),i=e.i(14747),n=e.i(46786),a=e.i(89196);let o=(0,i.join)((0,n.homedir)(),".config","opencode"),s=(0,i.join)(o,"oh-my-opencode.jsonc"),l="https://opencode.ai/config.json";function d(e=s){try{return(0,r.existsSync)(e)}catch{return!1}}async function u(e=s){try{let r=await (0,t.readFile)(e,"utf-8");return(0,a.parse)(r,null,!1)}catch{return{}}}async function p(e,n=s){try{let o=(0,i.join)(n,"..");(0,r.existsSync)(o)||(0,r.mkdirSync)(o,{recursive:!0});let d=n===s?{...e,$schema:e.$schema||l}:e,u=(0,a.stringify)(d,null,2);await (0,t.writeFile)(n,u,"utf-8")}catch(e){throw Error(`Failed to write config: ${e}`)}}e.s(["CONFIG_PATH",0,s,"OPEN_CODE_CONFIG_SCHEMA",0,l,"detectConfig",()=>d,"readConfig",()=>u,"writeConfig",()=>p])},53977,e=>{"use strict";var t=e.i(24868),r=e.i(22734),i=e.i(14747),n=e.i(46786),a=e.i(89196),o=e.i(57181);let s=(0,i.join)((0,n.homedir)(),".config","opencode","profiles"),l=(0,i.join)(s,"index.json"),d=[{id:"balanced",name:"Balanced",emoji:"⚖️",description:"Balanced multi-model orchestration optimized for general coding tasks",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),isBuiltIn:!0}],u={balanced:{agents:{sisyphus:{model:"anthropic/claude-opus-4-6",variant:"max",temperature:.2,top_p:.9},oracle:{model:"openai/gpt-5.4",variant:"high",temperature:.2,top_p:.9},prometheus:{model:"anthropic/claude-opus-4-6",variant:"max",temperature:.2,top_p:.9},metis:{model:"anthropic/claude-opus-4-6",variant:"max",temperature:.2,top_p:.9},momus:{model:"openai/gpt-5.4",variant:"medium",temperature:.2,top_p:.9},atlas:{model:"anthropic/claude-sonnet-4-6",temperature:.2,top_p:.9},hepheastus:{model:"openai/gpt-5.3-codex",variant:"xhigh",temperature:.2,top_p:.9},librarian:{model:"anthropic/claude-sonnet-4-6",temperature:.3,top_p:.9},explore:{model:"anthropic/claude-haiku-4-5",temperature:.1,top_p:.9},"multimodal-looker":{model:"google/gemini-3.1-pro",variant:"high",temperature:.2,top_p:.9},"frontend-ui-ux":{model:"google/gemini-3.1-pro",variant:"high",temperature:.3,top_p:.9}},categories:{"visual-engineering":{model:"google/gemini-3.1-pro",variant:"high"},ultrabrain:{model:"openai/gpt-5.3-codex",variant:"xhigh"},deep:{model:"openai/gpt-5.3-codex",variant:"medium"},artistry:{model:"google/gemini-3.1-pro",variant:"high"},quick:{model:"anthropic/claude-haiku-4-5",temperature:.1},"unspecified-low":{model:"anthropic/claude-sonnet-4-6",temperature:.2},"unspecified-high":{model:"openai/gpt-5.4",variant:"high",temperature:.2},writing:{model:"google/gemini-3-flash",temperature:.3}}}};function p(){(0,r.existsSync)(s)||(0,r.mkdirSync)(s,{recursive:!0})}function c(e){return(0,i.join)(s,`${e}.json`)}function f(e){if(!e||"object"!=typeof e)return{$schema:o.OPEN_CODE_CONFIG_SCHEMA,agents:{}};let t=e.agents&&"object"==typeof e.agents?e.agents:{},r=e.categories&&"object"==typeof e.categories?e.categories:void 0;return{$schema:"string"==typeof e.$schema&&e.$schema.trim().length>0?e.$schema:o.OPEN_CODE_CONFIG_SCHEMA,agents:t,categories:r}}function g(){return{version:1,profiles:[...d],activeProfileId:null,lastModified:new Date().toISOString()}}async function h(){let e=new Set(d.map(e=>e.id));for(let i of["coding","writing","debug","minimal"])if(!e.has(i)){let e=c(i);(0,r.existsSync)(e)&&await (0,t.unlink)(e)}for(let e of d){let t=u[e.id]||{agents:{}};await R(e.id,t)}}async function m(){return w(!0)}async function x(){return w(!1)}async function w(e){try{if(p(),!(0,r.existsSync)(l)){let e=g();return await y(e),await h(),e}let e=await (0,t.readFile)(l,"utf-8"),i=(0,a.parse)(e,null,!1),n=!1;for(let e of d)i.profiles.some(t=>t.id===e.id)||(i.profiles.push(e),n=!0);let o=new Set(d.map(e=>e.id)),s=i.profiles.length;return i.profiles=i.profiles.filter(e=>!e.isBuiltIn||o.has(e.id)),i.profiles.length!==s&&(n=!0),await h(),n&&(i.lastModified=new Date().toISOString(),await y(i)),i}catch(t){if(!e)throw t;return g()}}async function y(e){p(),e.lastModified=new Date().toISOString();let r=(0,a.stringify)(e,null,2);await (0,t.writeFile)(l,r,"utf-8")}async function v(e){try{let i=c(e);if(!(0,r.existsSync)(i))return{$schema:o.OPEN_CODE_CONFIG_SCHEMA,agents:{}};let n=await (0,t.readFile)(i,"utf-8"),s=(0,a.parse)(n,null,!1),l=f(s);if(!s||"object"!=typeof s||"string"!=typeof s.$schema)try{await R(e,l)}catch{}return l}catch{return{$schema:o.OPEN_CODE_CONFIG_SCHEMA,agents:{}}}}async function R(e,r){p();let i=c(e),n=(0,a.stringify)(f(r),null,2);await (0,t.writeFile)(i,n,"utf-8")}async function E(e){let i=(await m()).profiles.find(t=>t.id===e);if(i?.isBuiltIn){let t=u[e]||{agents:{}};return await R(e,t),!0}let n=c(e);return!!(0,r.existsSync)(n)&&(await (0,t.unlink)(n),!0)}async function C(e){return(await m()).profiles.find(t=>t.id===e)}async function P(e){let t=await m();t.activeProfileId=e,await y(t)}e.s(["deleteProfileConfig",()=>E,"getProfileById",()=>C,"readProfileConfig",()=>v,"readProfileIndex",()=>m,"readProfileIndexStrict",()=>x,"setActiveProfileId",()=>P,"writeProfileConfig",()=>R,"writeProfileIndex",()=>y])},30754,e=>{"use strict";var t=e.i(47909),r=e.i(74017),i=e.i(96250),n=e.i(59756),a=e.i(61916),o=e.i(74677),s=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),f=e.i(70101),g=e.i(26937),h=e.i(10372),m=e.i(93695);e.i(52474);var x=e.i(220),w=e.i(89171),y=e.i(53977);async function v(e,{params:t}){try{let{id:e}=await t,r=await (0,y.getProfileById)(e);if(!r)return w.NextResponse.json({error:"Profile not found"},{status:404});let i=await (0,y.readProfileConfig)(e);return w.NextResponse.json({profile:r,config:i})}catch(e){return console.error("Error reading profile:",e),w.NextResponse.json({error:"Internal server error"},{status:500})}}async function R(e,{params:t}){try{let{id:r}=await t,i=await (0,y.getProfileById)(r);if(!i)return w.NextResponse.json({error:"Profile not found"},{status:404});let n=await e.json();if(!n||"object"!=typeof n)return w.NextResponse.json({error:"Invalid request body"},{status:400});let a=n.profile||n,{name:o,description:s,emoji:l}=a,d=n.config||a.config;if(void 0!==o){if("string"!=typeof o||""===o.trim())return w.NextResponse.json({error:"name must be a non-empty string"},{status:400});i.name=o.trim()}void 0!==s&&(i.description=s?.trim()||void 0),void 0!==l&&(i.emoji=l||"⚙️"),i.updatedAt=new Date().toISOString();let u=await (0,y.readProfileIndex)(),p=u.profiles.findIndex(e=>e.id===r);if(-1===p)return w.NextResponse.json({error:"Profile not found in index"},{status:404});return u.profiles[p]=i,await (0,y.writeProfileIndex)(u),d&&"object"==typeof d&&await (0,y.writeProfileConfig)(r,{agents:d.agents||{},categories:d.categories}),w.NextResponse.json({profile:i})}catch(e){return console.error("Error updating profile:",e),w.NextResponse.json({error:"Internal server error"},{status:500})}}async function E(e,{params:t}){try{let{id:e}=await t,r=await (0,y.getProfileById)(e);if(!r)return w.NextResponse.json({error:"Profile not found"},{status:404});if(r.isBuiltIn)return await (0,y.deleteProfileConfig)(e),w.NextResponse.json({message:"Built-in profile reset to defaults",profile:r});let i=await (0,y.readProfileIndex)();return i.profiles=i.profiles.filter(t=>t.id!==e),i.activeProfileId===e&&(i.activeProfileId=null),await (0,y.writeProfileIndex)(i),await (0,y.deleteProfileConfig)(e),w.NextResponse.json({message:"Profile deleted successfully"})}catch(e){return console.error("Error deleting profile:",e),w.NextResponse.json({error:"Internal server error"},{status:500})}}e.s(["DELETE",()=>E,"GET",()=>v,"PUT",()=>R],44170);var C=e.i(44170);let P=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/profiles/[id]/route",pathname:"/api/profiles/[id]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/profiles/[id]/route.ts",nextConfigOutput:"standalone",userland:C}),{workAsyncStorage:I,workUnitAsyncStorage:j,serverHooks:S}=P;function N(){return(0,i.patchFetch)({workAsyncStorage:I,workUnitAsyncStorage:j})}async function _(e,t,i){P.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/profiles/[id]/route";w=w.replace(/\/index$/,"")||"/";let y=await P.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve()),null;let{buildId:v,params:R,nextConfig:E,parsedUrl:C,isDraftMode:I,prerenderManifest:j,routerServerContext:S,isOnDemandRevalidate:N,revalidateOnlyGenerated:_,resolvedPathname:O,clientReferenceManifest:b,serverActionsManifest:A}=y,k=(0,s.normalizeAppPath)(w),T=!!(j.dynamicRoutes[k]||j.routes[O]),D=async()=>((null==S?void 0:S.render404)?await S.render404(e,t,C,!1):t.end("This page could not be found"),null);if(T&&!I){let e=!!j.routes[O],t=j.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await D();throw new m.NoFallbackError}}let q=null;!T||P.isDev||I||(q="/index"===(q=O)?"/":q);let H=!0===P.isDev||!T,F=T&&!H;A&&b&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:b,serverActionsManifest:A});let $=e.method||"GET",M=(0,a.getTracer)(),U=M.getActiveScopeSpan(),B={params:R,prerenderManifest:j,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:i.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,i,n)=>P.onRequestError(e,t,i,n,S)},sharedContext:{buildId:v}},G=new l.NodeNextRequest(e),K=new l.NodeNextResponse(t),L=d.NextRequestAdapter.fromNodeNextRequest(G,(0,d.signalFromNodeResponse)(t));try{let o=async e=>P.handle(L,B).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")!==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 i=r.get("next.route");if(i){let t=`${$} ${i}`;e.setAttributes({"next.route":i,"http.route":i,"next.span_name":t}),e.updateName(t)}else e.updateName(`${$} ${w}`)}),s=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var a,l;let d=async({previousCacheEntry:r})=>{try{if(!s&&N&&_&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(n);e.fetchMetrics=B.renderOpts.fetchMetrics;let l=B.renderOpts.pendingWaitUntil;l&&i.waitUntil&&(i.waitUntil(l),l=void 0);let d=B.renderOpts.collectedTags;if(!T)return await (0,c.sendResponse)(G,K,a,B.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);d&&(t[h.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,i=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:i}}}}catch(t){throw(null==r?void 0:r.isStale)&&await P.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,S),t}},u=await P.handleResponse({req:e,nextConfig:E,cacheKey:q,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:_,responseGenerator:d,waitUntil:i.waitUntil,isMinimalMode:s});if(!T)return null;if((null==u||null==(a=u.value)?void 0:a.kind)!==x.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});s||t.setHeader("x-nextjs-cache",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),I&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return s&&T||m.delete(h.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,g.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(G,K,new Response(u.value.body,{headers:m,status:u.value.status||200})),null};U?await l(U):await M.withPropagatedContext(e.headers,()=>M.trace(u.BaseServerSpan.handleRequest,{spanName:`${$} ${w}`,kind:a.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},l))}catch(t){if(t instanceof m.NoFallbackError||await P.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:N})},!1,S),T)throw t;return await (0,c.sendResponse)(G,K,new Response(null,{status:500})),null}}e.s(["handler",()=>_,"patchFetch",()=>N,"routeModule",()=>P,"serverHooks",()=>S,"workAsyncStorage",()=>I,"workUnitAsyncStorage",()=>j],30754)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__59175de4._.js.map