vibepulse 0.2.0 → 0.2.1

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 (420) 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 +32 -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.js +1 -1
  32. package/.next/server/app/api/node/events/route.js.nft.json +1 -1
  33. package/.next/server/app/api/node/health/route.js +1 -1
  34. package/.next/server/app/api/node/health/route.js.nft.json +1 -1
  35. package/.next/server/app/api/node/sessions/[id]/archive/route/app-paths-manifest.json +3 -0
  36. package/.next/server/app/api/node/sessions/[id]/archive/route/build-manifest.json +11 -0
  37. package/.next/server/app/api/node/sessions/[id]/archive/route/server-reference-manifest.json +4 -0
  38. package/.next/server/app/api/node/sessions/[id]/archive/route.js +6 -0
  39. package/.next/server/app/api/node/sessions/[id]/archive/route.js.map +5 -0
  40. package/.next/server/app/api/node/sessions/[id]/archive/route.js.nft.json +1 -0
  41. package/.next/server/app/api/node/sessions/[id]/archive/route_client-reference-manifest.js +2 -0
  42. package/.next/server/app/api/node/sessions/[id]/delete/route/app-paths-manifest.json +3 -0
  43. package/.next/server/app/api/node/sessions/[id]/delete/route/build-manifest.json +11 -0
  44. package/.next/server/app/api/node/sessions/[id]/delete/route/server-reference-manifest.json +4 -0
  45. package/.next/server/app/api/node/sessions/[id]/delete/route.js +7 -0
  46. package/.next/server/app/api/node/sessions/[id]/delete/route.js.map +5 -0
  47. package/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -0
  48. package/.next/server/app/api/node/sessions/[id]/delete/route_client-reference-manifest.js +2 -0
  49. package/.next/server/app/api/node/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  50. package/.next/server/app/api/node/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  51. package/.next/server/app/api/node/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  52. package/.next/server/app/api/node/sessions/[id]/open-editor/route.js +7 -0
  53. package/.next/server/app/api/node/sessions/[id]/open-editor/route.js.map +5 -0
  54. package/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -0
  55. package/.next/server/app/api/node/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  56. package/.next/server/app/api/node/sessions/route.js +1 -1
  57. package/.next/server/app/api/node/sessions/route.js.nft.json +1 -1
  58. package/.next/server/app/api/opencode-events/route.js +1 -1
  59. package/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
  60. package/.next/server/app/api/sessions/[id]/archive/route.js +2 -1
  61. package/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
  62. package/.next/server/app/api/sessions/[id]/delete/route.js +3 -2
  63. package/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
  64. package/.next/server/app/api/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  65. package/.next/server/app/api/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  66. package/.next/server/app/api/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  67. package/.next/server/app/api/sessions/[id]/open-editor/route.js +7 -0
  68. package/.next/server/app/api/sessions/[id]/open-editor/route.js.map +5 -0
  69. package/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -0
  70. package/.next/server/app/api/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  71. package/.next/server/app/api/sessions/route.js +1 -1
  72. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  73. package/.next/server/app/index.html +1 -1
  74. package/.next/server/app/index.rsc +3 -3
  75. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  76. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  77. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  78. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  79. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  80. package/.next/server/app/page.js +1 -1
  81. package/.next/server/app/page.js.nft.json +1 -1
  82. package/.next/server/app/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app-paths-manifest.json +4 -0
  84. package/.next/server/chunks/[root-of-the-server]__1211da38._.js +3 -0
  85. package/.next/server/chunks/[root-of-the-server]__1211da38._.js.map +1 -0
  86. package/.next/{standalone/.next/server/chunks/[root-of-the-server]__b698889b._.js → server/chunks/[root-of-the-server]__1b87ec42._.js} +2 -2
  87. package/.next/server/chunks/[root-of-the-server]__1b87ec42._.js.map +1 -0
  88. package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +3 -0
  89. package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js.map +1 -0
  90. package/.next/server/chunks/[root-of-the-server]__2f981540._.js +3 -0
  91. package/.next/server/chunks/[root-of-the-server]__2f981540._.js.map +1 -0
  92. package/.next/server/chunks/[root-of-the-server]__3745b314._.js +3 -0
  93. package/.next/server/chunks/[root-of-the-server]__3745b314._.js.map +1 -0
  94. package/.next/server/chunks/[root-of-the-server]__56690af0._.js +1 -1
  95. package/.next/server/chunks/[root-of-the-server]__56690af0._.js.map +1 -1
  96. package/.next/server/chunks/[root-of-the-server]__56f5f249._.js +1 -1
  97. package/.next/server/chunks/[root-of-the-server]__56f5f249._.js.map +1 -1
  98. package/.next/server/chunks/[root-of-the-server]__59175de4._.js +1 -1
  99. package/.next/server/chunks/[root-of-the-server]__59175de4._.js.map +1 -1
  100. package/.next/server/chunks/[root-of-the-server]__64fffc02._.js +1 -1
  101. package/.next/server/chunks/[root-of-the-server]__64fffc02._.js.map +1 -1
  102. package/.next/server/chunks/[root-of-the-server]__6c428a24._.js +3 -0
  103. package/.next/server/chunks/[root-of-the-server]__6c428a24._.js.map +1 -0
  104. package/.next/server/chunks/[root-of-the-server]__73a00b88._.js +3 -0
  105. package/.next/server/chunks/[root-of-the-server]__73a00b88._.js.map +1 -0
  106. package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +1 -1
  107. package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js.map +1 -1
  108. package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +1 -1
  109. package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js.map +1 -1
  110. package/.next/server/chunks/[root-of-the-server]__b796d06c._.js +1 -1
  111. package/.next/server/chunks/[root-of-the-server]__b796d06c._.js.map +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js.map +1 -1
  114. package/.next/server/chunks/[root-of-the-server]__d8e61048._.js +3 -0
  115. package/.next/server/chunks/[root-of-the-server]__d8e61048._.js.map +1 -0
  116. package/.next/server/chunks/[root-of-the-server]__db285678._.js +3 -0
  117. package/.next/server/chunks/[root-of-the-server]__db285678._.js.map +1 -0
  118. package/.next/{standalone/.next/server/chunks/[root-of-the-server]__16a9eb0a._.js → server/chunks/[root-of-the-server]__e00a9200._.js} +2 -2
  119. package/.next/server/chunks/{[root-of-the-server]__16a9eb0a._.js.map → [root-of-the-server]__e00a9200._.js.map} +1 -1
  120. package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +3 -0
  121. package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js.map +1 -0
  122. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js +3 -0
  123. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js.map +1 -0
  124. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js +3 -0
  125. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js.map +1 -0
  126. package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js +3 -0
  127. package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js.map +1 -0
  128. package/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js +3 -0
  129. package/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js.map +1 -0
  130. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
  131. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js.map +1 -1
  132. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
  133. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js.map +1 -1
  134. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +2 -2
  135. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js.map +1 -1
  136. package/.next/server/chunks/ssr/{[root-of-the-server]__efc52f08._.js → [root-of-the-server]__631e12d0._.js} +2 -2
  137. package/.next/server/chunks/ssr/[root-of-the-server]__a8cd3911._.js +3 -0
  138. package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
  139. package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js.map +1 -1
  140. package/.next/server/pages/404.html +1 -1
  141. package/.next/server/pages/500.html +2 -2
  142. package/.next/server/server-reference-manifest.js +1 -1
  143. package/.next/server/server-reference-manifest.json +1 -1
  144. package/.next/standalone/.next/BUILD_ID +1 -1
  145. package/.next/standalone/.next/app-path-routes-manifest.json +4 -0
  146. package/.next/standalone/.next/build-manifest.json +2 -2
  147. package/.next/standalone/.next/prerender-manifest.json +3 -3
  148. package/.next/standalone/.next/routes-manifest.json +32 -0
  149. package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
  150. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  151. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  152. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  153. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  154. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  155. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  156. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  157. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  158. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  159. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  161. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  162. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  163. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  164. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  165. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  166. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  167. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  168. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  169. package/.next/standalone/.next/server/app/api/node/events/route.js +1 -1
  170. package/.next/standalone/.next/server/app/api/node/events/route.js.nft.json +1 -1
  171. package/.next/standalone/.next/server/app/api/node/health/route.js +1 -1
  172. package/.next/standalone/.next/server/app/api/node/health/route.js.nft.json +1 -1
  173. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/app-paths-manifest.json +3 -0
  174. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/build-manifest.json +11 -0
  175. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/server-reference-manifest.json +4 -0
  176. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js +6 -0
  177. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js.map +5 -0
  178. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js.nft.json +1 -0
  179. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route_client-reference-manifest.js +2 -0
  180. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/app-paths-manifest.json +3 -0
  181. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/build-manifest.json +11 -0
  182. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/server-reference-manifest.json +4 -0
  183. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js +7 -0
  184. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js.map +5 -0
  185. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -0
  186. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route_client-reference-manifest.js +2 -0
  187. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  188. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  189. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  190. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js +7 -0
  191. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js.map +5 -0
  192. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -0
  193. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  194. package/.next/standalone/.next/server/app/api/node/sessions/route.js +1 -1
  195. package/.next/standalone/.next/server/app/api/node/sessions/route.js.nft.json +1 -1
  196. package/.next/standalone/.next/server/app/api/opencode-events/route.js +1 -1
  197. package/.next/standalone/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js +2 -1
  199. package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js +3 -2
  201. package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  203. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  204. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  205. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js +7 -0
  206. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js.map +5 -0
  207. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -0
  208. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  209. package/.next/standalone/.next/server/app/api/sessions/route.js +1 -1
  210. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  211. package/.next/standalone/.next/server/app/index.html +1 -1
  212. package/.next/standalone/.next/server/app/index.rsc +3 -3
  213. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  214. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  215. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  216. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  217. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  218. package/.next/standalone/.next/server/app/page.js +1 -1
  219. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  220. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  221. package/.next/standalone/.next/server/app-paths-manifest.json +4 -0
  222. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1211da38._.js +3 -0
  223. package/.next/{server/chunks/[root-of-the-server]__b698889b._.js → standalone/.next/server/chunks/[root-of-the-server]__1b87ec42._.js} +2 -2
  224. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +3 -0
  225. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f981540._.js +3 -0
  226. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3745b314._.js +3 -0
  227. package/.next/standalone/.next/server/chunks/[root-of-the-server]__56690af0._.js +1 -1
  228. package/.next/standalone/.next/server/chunks/[root-of-the-server]__56f5f249._.js +1 -1
  229. package/.next/standalone/.next/server/chunks/[root-of-the-server]__59175de4._.js +1 -1
  230. package/.next/standalone/.next/server/chunks/[root-of-the-server]__64fffc02._.js +1 -1
  231. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c428a24._.js +3 -0
  232. package/.next/standalone/.next/server/chunks/[root-of-the-server]__73a00b88._.js +3 -0
  233. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +1 -1
  234. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +1 -1
  235. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b796d06c._.js +1 -1
  236. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +1 -1
  237. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d8e61048._.js +3 -0
  238. package/.next/standalone/.next/server/chunks/[root-of-the-server]__db285678._.js +3 -0
  239. package/.next/{server/chunks/[root-of-the-server]__16a9eb0a._.js → standalone/.next/server/chunks/[root-of-the-server]__e00a9200._.js} +2 -2
  240. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +3 -0
  241. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js +3 -0
  242. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js +3 -0
  243. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js +3 -0
  244. package/.next/standalone/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js +3 -0
  245. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
  246. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
  247. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +2 -2
  248. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__efc52f08._.js → [root-of-the-server]__631e12d0._.js} +2 -2
  249. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__a8cd3911._.js +3 -0
  250. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
  251. package/.next/standalone/.next/server/pages/404.html +1 -1
  252. package/.next/standalone/.next/server/pages/500.html +2 -2
  253. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  254. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  255. package/.next/standalone/.next/static/chunks/7ac19aaef01f4a03.js +13 -0
  256. package/.next/standalone/.next/static/chunks/f42202943f6742e5.css +3 -0
  257. package/.next/standalone/AGENTS.md +85 -0
  258. package/.next/standalone/README.md +76 -0
  259. package/.next/standalone/__mocks__/child_process.ts +4 -0
  260. package/.next/standalone/bin/dev-runtime.js +58 -0
  261. package/.next/standalone/bin/vibepulse.js +87 -0
  262. package/.next/standalone/check-hsql.mjs +71 -0
  263. package/.next/standalone/docs/session-status-detection.md +258 -0
  264. package/.next/standalone/eslint.config.mjs +31 -0
  265. package/.next/standalone/next.config.ts +8 -0
  266. package/.next/standalone/package-lock.json +10312 -0
  267. package/.next/standalone/package.json +1 -1
  268. package/.next/standalone/postcss.config.mjs +7 -0
  269. package/.next/standalone/src/AGENTS.md +41 -0
  270. package/.next/standalone/src/app/api/AGENTS.md +40 -0
  271. package/.next/standalone/src/app/api/node/events/route.test.ts +196 -0
  272. package/.next/standalone/src/app/api/node/events/route.ts +259 -0
  273. package/.next/standalone/src/app/api/node/health/route.test.ts +190 -0
  274. package/.next/standalone/src/app/api/node/health/route.ts +48 -0
  275. package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.test.ts +128 -0
  276. package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.ts +97 -0
  277. package/.next/standalone/src/app/api/node/sessions/[id]/delete/route.test.ts +113 -0
  278. package/.next/standalone/src/app/api/node/sessions/[id]/delete/route.ts +81 -0
  279. package/.next/standalone/src/app/api/node/sessions/[id]/open-editor/route.test.ts +206 -0
  280. package/.next/standalone/src/app/api/node/sessions/[id]/open-editor/route.ts +123 -0
  281. package/.next/standalone/src/app/api/node/sessions/route.test.ts +408 -0
  282. package/.next/standalone/src/app/api/node/sessions/route.ts +1094 -0
  283. package/.next/standalone/src/app/api/nodes/route.test.ts +237 -0
  284. package/.next/standalone/src/app/api/nodes/route.ts +176 -0
  285. package/.next/standalone/src/app/api/opencode-config/route.test.ts +86 -0
  286. package/.next/standalone/src/app/api/opencode-config/route.ts +376 -0
  287. package/.next/standalone/src/app/api/opencode-config/status/route.ts +31 -0
  288. package/.next/standalone/src/app/api/opencode-events/route.test.ts +624 -0
  289. package/.next/standalone/src/app/api/opencode-events/route.ts +508 -0
  290. package/.next/standalone/src/app/api/opencode-models/route.test.ts +167 -0
  291. package/.next/standalone/src/app/api/opencode-models/route.ts +76 -0
  292. package/.next/standalone/src/app/api/profiles/[id]/apply/route.ts +49 -0
  293. package/.next/standalone/src/app/api/profiles/[id]/export/route.ts +31 -0
  294. package/.next/standalone/src/app/api/profiles/[id]/route.ts +160 -0
  295. package/.next/standalone/src/app/api/profiles/import/route.test.js +107 -0
  296. package/.next/standalone/src/app/api/profiles/import/route.ts +65 -0
  297. package/.next/standalone/src/app/api/profiles/route.ts +107 -0
  298. package/.next/standalone/src/app/api/sessions/[id]/archive/route.test.ts +136 -0
  299. package/.next/standalone/src/app/api/sessions/[id]/archive/route.ts +170 -0
  300. package/.next/standalone/src/app/api/sessions/[id]/delete/route.test.ts +113 -0
  301. package/.next/standalone/src/app/api/sessions/[id]/delete/route.ts +137 -0
  302. package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.test.ts +218 -0
  303. package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.ts +85 -0
  304. package/.next/standalone/src/app/api/sessions/[id]/route.test.ts +531 -0
  305. package/.next/standalone/src/app/api/sessions/[id]/route.ts +75 -0
  306. package/.next/standalone/src/app/api/sessions/route.test.ts +1298 -0
  307. package/.next/standalone/src/app/api/sessions/route.ts +1695 -0
  308. package/.next/standalone/src/app/favicon.ico +0 -0
  309. package/.next/standalone/src/app/globals.css +66 -0
  310. package/.next/standalone/src/app/layout.tsx +37 -0
  311. package/.next/standalone/src/app/page.test.tsx +134 -0
  312. package/.next/standalone/src/app/page.tsx +358 -0
  313. package/.next/standalone/src/components/AGENTS.md +42 -0
  314. package/.next/standalone/src/components/ErrorBoundary.tsx +72 -0
  315. package/.next/standalone/src/components/KanbanBoard.test.tsx +704 -0
  316. package/.next/standalone/src/components/KanbanBoard.tsx +852 -0
  317. package/.next/standalone/src/components/LoadingState.tsx +37 -0
  318. package/.next/standalone/src/components/ProjectCard.test.tsx +773 -0
  319. package/.next/standalone/src/components/ProjectCard.tsx +595 -0
  320. package/.next/standalone/src/components/QueryProvider.tsx +25 -0
  321. package/.next/standalone/src/components/SessionCard.test.tsx +566 -0
  322. package/.next/standalone/src/components/SessionCard.tsx +434 -0
  323. package/.next/standalone/src/components/SessionList.tsx +60 -0
  324. package/.next/standalone/src/components/host-config/HostManagerDialog.test.tsx +252 -0
  325. package/.next/standalone/src/components/host-config/HostManagerDialog.tsx +476 -0
  326. package/.next/standalone/src/components/opencode-config/AgentConfigForm.test.tsx +72 -0
  327. package/.next/standalone/src/components/opencode-config/AgentConfigForm.tsx +483 -0
  328. package/.next/standalone/src/components/opencode-config/AgentModelSelector.tsx +284 -0
  329. package/.next/standalone/src/components/opencode-config/AgentsConfigPanel.tsx +162 -0
  330. package/.next/standalone/src/components/opencode-config/ConfigButton.tsx +43 -0
  331. package/.next/standalone/src/components/opencode-config/ConfigPanel.tsx +91 -0
  332. package/.next/standalone/src/components/opencode-config/FullscreenConfigPanel.tsx +435 -0
  333. package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.test.tsx +91 -0
  334. package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.tsx +288 -0
  335. package/.next/standalone/src/components/opencode-config/categories/CategoriesList.tsx +382 -0
  336. package/.next/standalone/src/components/opencode-config/categories/CategoriesManager.test.tsx +111 -0
  337. package/.next/standalone/src/components/opencode-config/categories/CategoriesManager.tsx +174 -0
  338. package/.next/standalone/src/components/opencode-config/categories/CategoryConfigForm.tsx +453 -0
  339. package/.next/standalone/src/components/opencode-config/profiles/ProfileCard.tsx +140 -0
  340. package/.next/standalone/src/components/opencode-config/profiles/ProfileEditor.tsx +446 -0
  341. package/.next/standalone/src/components/opencode-config/profiles/ProfileList.tsx +446 -0
  342. package/.next/standalone/src/components/opencode-config/profiles/ProfileManager.test.tsx +225 -0
  343. package/.next/standalone/src/components/opencode-config/profiles/ProfileManager.tsx +405 -0
  344. package/.next/standalone/src/components/ui/Tabs.tsx +59 -0
  345. package/.next/standalone/src/hooks/useHostSources.test.ts +509 -0
  346. package/.next/standalone/src/hooks/useHostSources.ts +299 -0
  347. package/.next/standalone/src/hooks/useOpencodeSync.test.ts +387 -0
  348. package/.next/standalone/src/hooks/useOpencodeSync.ts +571 -0
  349. package/.next/standalone/src/index.ts +2 -0
  350. package/.next/standalone/src/lib/editorLauncher.server.ts +36 -0
  351. package/.next/standalone/src/lib/editorLauncher.test.ts +35 -0
  352. package/.next/standalone/src/lib/editorLauncher.ts +25 -0
  353. package/.next/standalone/src/lib/hostAccent.test.ts +58 -0
  354. package/.next/standalone/src/lib/hostAccent.ts +46 -0
  355. package/.next/standalone/src/lib/hostIdentity.test.ts +187 -0
  356. package/.next/standalone/src/lib/hostIdentity.ts +122 -0
  357. package/.next/standalone/src/lib/hostSourcesStorage.test.ts +141 -0
  358. package/.next/standalone/src/lib/hostSourcesStorage.ts +72 -0
  359. package/.next/standalone/src/lib/nodeProtocol.test.ts +159 -0
  360. package/.next/standalone/src/lib/nodeProtocol.ts +142 -0
  361. package/.next/standalone/src/lib/nodeRegistry.test.ts +173 -0
  362. package/.next/standalone/src/lib/nodeRegistry.ts +398 -0
  363. package/.next/standalone/src/lib/notificationSound.ts +292 -0
  364. package/.next/standalone/src/lib/opencodeConfig.test.ts +100 -0
  365. package/.next/standalone/src/lib/opencodeConfig.ts +76 -0
  366. package/.next/standalone/src/lib/opencodeDiscovery.ts +275 -0
  367. package/.next/standalone/src/lib/profiles/share.test.ts +91 -0
  368. package/.next/standalone/src/lib/profiles/share.ts +93 -0
  369. package/.next/standalone/src/lib/profiles/storage.test.ts +108 -0
  370. package/.next/standalone/src/lib/profiles/storage.ts +370 -0
  371. package/.next/standalone/src/lib/runtimeMode.test.ts +29 -0
  372. package/.next/standalone/src/lib/runtimeMode.ts +29 -0
  373. package/.next/standalone/src/lib/sessionActionErrors.ts +37 -0
  374. package/.next/standalone/src/lib/sessionArchiveOverrides.test.ts +43 -0
  375. package/.next/standalone/src/lib/sessionArchiveOverrides.ts +116 -0
  376. package/.next/standalone/src/lib/transform.test.ts +121 -0
  377. package/.next/standalone/src/lib/transform.ts +193 -0
  378. package/.next/standalone/src/test/setup.ts +8 -0
  379. package/.next/standalone/src/types/index.ts +152 -0
  380. package/.next/standalone/src/types/opencodeConfig.ts +149 -0
  381. package/.next/standalone/tsconfig.json +34 -0
  382. package/.next/standalone/tsconfig.lib.json +17 -0
  383. package/.next/standalone/vitest.config.ts +16 -0
  384. package/.next/static/chunks/7ac19aaef01f4a03.js +13 -0
  385. package/.next/static/chunks/f42202943f6742e5.css +3 -0
  386. package/.next/trace +1 -1
  387. package/.next/trace-build +1 -1
  388. package/.next/types/routes.d.ts +5 -1
  389. package/.next/types/validator.ts +36 -0
  390. package/package.json +1 -1
  391. package/.next/server/chunks/[root-of-the-server]__0b017945._.js +0 -3
  392. package/.next/server/chunks/[root-of-the-server]__0b017945._.js.map +0 -1
  393. package/.next/server/chunks/[root-of-the-server]__1e118bd3._.js +0 -3
  394. package/.next/server/chunks/[root-of-the-server]__1e118bd3._.js.map +0 -1
  395. package/.next/server/chunks/[root-of-the-server]__6979e732._.js +0 -3
  396. package/.next/server/chunks/[root-of-the-server]__6979e732._.js.map +0 -1
  397. package/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js +0 -3
  398. package/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js.map +0 -1
  399. package/.next/server/chunks/[root-of-the-server]__b698889b._.js.map +0 -1
  400. package/.next/server/chunks/[root-of-the-server]__ddc251b7._.js +0 -3
  401. package/.next/server/chunks/[root-of-the-server]__ddc251b7._.js.map +0 -1
  402. package/.next/server/chunks/ssr/[root-of-the-server]__b0788643._.js +0 -3
  403. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b017945._.js +0 -3
  404. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1e118bd3._.js +0 -3
  405. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6979e732._.js +0 -3
  406. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js +0 -3
  407. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ddc251b7._.js +0 -3
  408. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__b0788643._.js +0 -3
  409. package/.next/standalone/.next/static/chunks/9f8c22002e7395e8.js +0 -13
  410. package/.next/standalone/.next/static/chunks/f1b55db60e7ed6f3.css +0 -3
  411. package/.next/static/chunks/9f8c22002e7395e8.js +0 -13
  412. package/.next/static/chunks/f1b55db60e7ed6f3.css +0 -3
  413. /package/.next/server/chunks/ssr/{[root-of-the-server]__efc52f08._.js.map → [root-of-the-server]__631e12d0._.js.map} +0 -0
  414. /package/.next/server/chunks/ssr/{[root-of-the-server]__b0788643._.js.map → [root-of-the-server]__a8cd3911._.js.map} +0 -0
  415. /package/.next/standalone/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_buildManifest.js +0 -0
  416. /package/.next/standalone/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_clientMiddlewareManifest.json +0 -0
  417. /package/.next/standalone/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_ssgManifest.js +0 -0
  418. /package/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_buildManifest.js +0 -0
  419. /package/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_clientMiddlewareManifest.json +0 -0
  420. /package/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/opencodeConfig.ts","../../../src/lib/profiles/storage.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/profiles/route.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","import { readFile, writeFile, unlink } from 'fs/promises';\nimport { existsSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { parse, stringify } from 'comment-json';\nimport { OPEN_CODE_CONFIG_SCHEMA } from '../opencodeConfig';\nimport type { AgentConfig, CategoryConfig } from '@/types/opencodeConfig';\n\nexport const PROFILES_DIR = join(homedir(), '.config', 'opencode', 'profiles');\nexport const PROFILE_INDEX_PATH = join(PROFILES_DIR, 'index.json');\n\nexport interface Profile {\n id: string;\n name: string;\n emoji: string;\n description?: string;\n createdAt: string;\n updatedAt: string;\n isDefault?: boolean;\n isBuiltIn?: boolean;\n}\n\nexport interface ProfileIndex {\n version: number;\n profiles: Profile[];\n activeProfileId: string | null;\n lastModified: string;\n}\n\nexport interface ProfileConfig {\n $schema?: string;\n agents: Record<string, AgentConfig>;\n categories?: Record<string, CategoryConfig>;\n}\n\nconst BUILTIN_PROFILES: Profile[] = [\n {\n id: 'balanced',\n name: 'Balanced',\n emoji: '⚖️',\n description: 'Balanced multi-model orchestration optimized for general coding tasks',\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n isBuiltIn: true,\n },\n];\n\nconst BUILTIN_PROFILE_CONFIGS: Record<string, ProfileConfig> = {\n balanced: {\n agents: {\n sisyphus: {\n model: 'anthropic/claude-opus-4-6',\n variant: 'max',\n temperature: 0.2,\n top_p: 0.9,\n },\n oracle: {\n model: 'openai/gpt-5.4',\n variant: 'high',\n temperature: 0.2,\n top_p: 0.9,\n },\n prometheus: {\n model: 'anthropic/claude-opus-4-6',\n variant: 'max',\n temperature: 0.2,\n top_p: 0.9,\n },\n metis: {\n model: 'anthropic/claude-opus-4-6',\n variant: 'max',\n temperature: 0.2,\n top_p: 0.9,\n },\n momus: {\n model: 'openai/gpt-5.4',\n variant: 'medium',\n temperature: 0.2,\n top_p: 0.9,\n },\n atlas: {\n model: 'anthropic/claude-sonnet-4-6',\n temperature: 0.2,\n top_p: 0.9,\n },\n hepheastus: {\n model: 'openai/gpt-5.3-codex',\n variant: 'xhigh',\n temperature: 0.2,\n top_p: 0.9,\n },\n librarian: {\n model: 'anthropic/claude-sonnet-4-6',\n temperature: 0.3,\n top_p: 0.9,\n },\n explore: {\n model: 'anthropic/claude-haiku-4-5',\n temperature: 0.1,\n top_p: 0.9,\n },\n 'multimodal-looker': {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n temperature: 0.2,\n top_p: 0.9,\n },\n 'frontend-ui-ux': {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n temperature: 0.3,\n top_p: 0.9,\n },\n },\n categories: {\n 'visual-engineering': {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n },\n ultrabrain: {\n model: 'openai/gpt-5.3-codex',\n variant: 'xhigh',\n },\n deep: {\n model: 'openai/gpt-5.3-codex',\n variant: 'medium',\n },\n artistry: {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n },\n quick: {\n model: 'anthropic/claude-haiku-4-5',\n temperature: 0.1,\n },\n 'unspecified-low': {\n model: 'anthropic/claude-sonnet-4-6',\n temperature: 0.2,\n },\n 'unspecified-high': {\n model: 'openai/gpt-5.4',\n variant: 'high',\n temperature: 0.2,\n },\n writing: {\n model: 'google/gemini-3-flash',\n temperature: 0.3,\n },\n },\n },\n};\n\nexport function ensureProfilesDir(): void {\n if (!existsSync(PROFILES_DIR)) {\n mkdirSync(PROFILES_DIR, { recursive: true });\n }\n}\n\nfunction getProfileConfigPath(id: string): string {\n return join(PROFILES_DIR, `${id}.json`);\n}\n\nfunction normalizeProfileConfig(config: unknown): ProfileConfig {\n if (!config || typeof config !== 'object') {\n return {\n $schema: OPEN_CODE_CONFIG_SCHEMA,\n agents: {},\n };\n }\n\n const candidate = config as Record<string, unknown>;\n const agents =\n candidate.agents && typeof candidate.agents === 'object'\n ? (candidate.agents as Record<string, AgentConfig>)\n : {};\n\n const categories =\n candidate.categories && typeof candidate.categories === 'object'\n ? (candidate.categories as Record<string, CategoryConfig>)\n : undefined;\n\n const schema =\n typeof candidate.$schema === 'string' && candidate.$schema.trim().length > 0\n ? candidate.$schema\n : OPEN_CODE_CONFIG_SCHEMA;\n\n return {\n $schema: schema,\n agents,\n categories,\n };\n}\n\nfunction createDefaultProfileIndex(): ProfileIndex {\n return {\n version: 1,\n profiles: [...BUILTIN_PROFILES],\n activeProfileId: null,\n lastModified: new Date().toISOString(),\n };\n}\n\nasync function createBuiltinProfileConfigs(): Promise<void> {\n const validBuiltinIds = new Set(BUILTIN_PROFILES.map(p => p.id));\n const deprecatedBuiltinIds = ['coding', 'writing', 'debug', 'minimal'];\n\n for (const deprecatedId of deprecatedBuiltinIds) {\n if (!validBuiltinIds.has(deprecatedId)) {\n const deprecatedConfigPath = getProfileConfigPath(deprecatedId);\n if (existsSync(deprecatedConfigPath)) {\n await unlink(deprecatedConfigPath);\n }\n }\n }\n\n for (const profile of BUILTIN_PROFILES) {\n const config = BUILTIN_PROFILE_CONFIGS[profile.id] || { agents: {} };\n await writeProfileConfig(profile.id, config);\n }\n}\n\nexport async function readProfileIndex(): Promise<ProfileIndex> {\n return readProfileIndexInternal(true);\n}\n\nexport async function readProfileIndexStrict(): Promise<ProfileIndex> {\n return readProfileIndexInternal(false);\n}\n\nasync function readProfileIndexInternal(fallbackOnError: boolean): Promise<ProfileIndex> {\n try {\n ensureProfilesDir();\n\n if (!existsSync(PROFILE_INDEX_PATH)) {\n const defaultIndex = createDefaultProfileIndex();\n await writeProfileIndex(defaultIndex);\n await createBuiltinProfileConfigs();\n return defaultIndex;\n }\n\n const content = await readFile(PROFILE_INDEX_PATH, 'utf-8');\n const index = parse(content, null, false) as unknown as ProfileIndex;\n \n // Ensure all built-in profiles exist in the index\n let modified = false;\n for (const builtinProfile of BUILTIN_PROFILES) {\n const exists = index.profiles.some(p => p.id === builtinProfile.id);\n if (!exists) {\n index.profiles.push(builtinProfile);\n modified = true;\n }\n }\n \n // Remove built-in profiles that are no longer in BUILTIN_PROFILES\n const builtinIds = new Set(BUILTIN_PROFILES.map(p => p.id));\n const oldLength = index.profiles.length;\n index.profiles = index.profiles.filter(p => !p.isBuiltIn || builtinIds.has(p.id));\n if (index.profiles.length !== oldLength) {\n modified = true;\n }\n \n await createBuiltinProfileConfigs();\n \n if (modified) {\n index.lastModified = new Date().toISOString();\n await writeProfileIndex(index);\n }\n \n return index;\n } catch (error) {\n if (!fallbackOnError) {\n throw error;\n }\n return createDefaultProfileIndex();\n }\n}\n\nexport async function writeProfileIndex(index: ProfileIndex): Promise<void> {\n ensureProfilesDir();\n \n index.lastModified = new Date().toISOString();\n const content = stringify(index, null, 2);\n \n await writeFile(PROFILE_INDEX_PATH, content, 'utf-8');\n}\n\n\nexport async function readProfileConfig(id: string): Promise<ProfileConfig> {\n try {\n const configPath = getProfileConfigPath(id);\n \n if (!existsSync(configPath)) {\n return {\n $schema: OPEN_CODE_CONFIG_SCHEMA,\n agents: {},\n };\n }\n\n const content = await readFile(configPath, 'utf-8');\n const parsedConfig = parse(content, null, false) as unknown;\n const normalizedConfig = normalizeProfileConfig(parsedConfig);\n\n if (\n !parsedConfig ||\n typeof parsedConfig !== 'object' ||\n typeof (parsedConfig as { $schema?: unknown }).$schema !== 'string'\n ) {\n try {\n await writeProfileConfig(id, normalizedConfig);\n } catch {\n return normalizedConfig;\n }\n }\n\n return normalizedConfig;\n } catch {\n return {\n $schema: OPEN_CODE_CONFIG_SCHEMA,\n agents: {},\n };\n }\n}\n\nexport async function writeProfileConfig(\n id: string, \n config: ProfileConfig\n): Promise<void> {\n ensureProfilesDir();\n\n const configPath = getProfileConfigPath(id);\n const content = stringify(normalizeProfileConfig(config), null, 2);\n\n await writeFile(configPath, content, 'utf-8');\n}\n\nexport async function deleteProfileConfig(id: string): Promise<boolean> {\n const index = await readProfileIndex();\n const profile = index.profiles.find(p => p.id === id);\n \n if (profile?.isBuiltIn) {\n const defaultConfig = BUILTIN_PROFILE_CONFIGS[id] || { agents: {} };\n await writeProfileConfig(id, defaultConfig);\n return true;\n }\n \n const configPath = getProfileConfigPath(id);\n \n if (!existsSync(configPath)) {\n return false;\n }\n \n await unlink(configPath);\n return true;\n}\n\nexport async function getProfileById(id: string): Promise<Profile | undefined> {\n const index = await readProfileIndex();\n return index.profiles.find(p => p.id === id);\n}\n\nexport async function getActiveProfileId(): Promise<string | null> {\n const index = await readProfileIndex();\n return index.activeProfileId;\n}\n\nexport async function setActiveProfileId(id: string | null): Promise<void> {\n const index = await readProfileIndex();\n index.activeProfileId = id;\n await writeProfileIndex(index);\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/profiles/route\",\n pathname: \"/api/profiles\",\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/profiles/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/profiles/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextRequest, NextResponse } from 'next/server';\nimport {\n readProfileIndex,\n writeProfileIndex,\n getProfileById,\n writeProfileConfig,\n} from '@/lib/profiles/storage';\nimport type { Profile, ProfileConfig } from '@/lib/profiles/storage';\n\nexport async function GET() {\n try {\n const index = await readProfileIndex();\n \n return NextResponse.json({\n profiles: index.profiles,\n activeProfileId: index.activeProfileId,\n });\n } catch (error) {\n console.error('Error reading profiles:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\n }\n}\n\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json();\n\n if (!body || typeof body !== 'object') {\n return NextResponse.json(\n { error: 'Invalid request body' },\n { status: 400 }\n );\n }\n\n // Support both { id, name, ... } and { profile: { id, name, ... }, config } formats\n const profileData = body.profile || body;\n const { id, name, emoji, description } = profileData;\n const config = body.config || profileData.config;\n\n if (!id || typeof id !== 'string' || id.trim() === '') {\n return NextResponse.json(\n { error: 'id is required and must be a non-empty string' },\n { status: 400 }\n );\n }\n\n if (!name || typeof name !== 'string' || name.trim() === '') {\n return NextResponse.json(\n { error: 'name is required and must be a non-empty string' },\n { status: 400 }\n );\n }\n\n const existingProfile = await getProfileById(id);\n if (existingProfile) {\n return NextResponse.json(\n { error: `Profile with id '${id}' already exists` },\n { status: 400 }\n );\n }\n\n if (!/^[a-zA-Z0-9_-]+$/.test(id)) {\n return NextResponse.json(\n { error: 'id must contain only letters, numbers, hyphens, and underscores' },\n { status: 400 }\n );\n }\n\n const now = new Date().toISOString();\n const newProfile: Profile = {\n id: id.trim(),\n name: name.trim(),\n emoji: emoji || '⚙️',\n description: description?.trim() || undefined,\n createdAt: now,\n updatedAt: now,\n };\n\n const index = await readProfileIndex();\n index.profiles.push(newProfile);\n await writeProfileIndex(index);\n\n if (config && typeof config === 'object') {\n const profileConfig: ProfileConfig = {\n agents: config.agents || {},\n categories: config.categories,\n };\n await writeProfileConfig(id, profileConfig);\n } else {\n await writeProfileConfig(id, { agents: {} });\n }\n\n return NextResponse.json(\n { profile: newProfile },\n { status: 201 }\n );\n } catch (error) {\n console.error('Error creating profile:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\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,CACR,AADQ,EAAA,EAAA,KAAK,AAAL,EAAM,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,E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A,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[2]}
1
+ {"version":3,"sources":["../../../src/lib/opencodeConfig.ts","../../../src/lib/profiles/storage.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/profiles/route.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';\nimport type { OpenEditorTargetMode, VibePulseConfig } from '@/types/opencodeConfig';\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';\nexport const DEFAULT_OPEN_EDITOR_TARGET_MODE: OpenEditorTargetMode = 'remote';\n\nexport type OpenCodeConfig = {\n $schema?: string;\n agents?: Record<string, unknown>;\n vibepulse?: VibePulseConfig;\n [key: string]: unknown;\n};\n\nexport function normalizeOpenEditorTargetMode(value: unknown): OpenEditorTargetMode {\n return value === 'hub' ? 'hub' : DEFAULT_OPEN_EDITOR_TARGET_MODE;\n}\n\nexport function normalizeVibePulseConfig(value: unknown): VibePulseConfig {\n const vibepulse = typeof value === 'object' && value !== null && !Array.isArray(value)\n ? { ...(value as Record<string, unknown>) }\n : {};\n\n return {\n ...vibepulse,\n openEditorTargetMode: normalizeOpenEditorTargetMode(vibepulse.openEditorTargetMode),\n };\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","import { readFile, writeFile, unlink } from 'fs/promises';\nimport { existsSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport { parse, stringify } from 'comment-json';\nimport { OPEN_CODE_CONFIG_SCHEMA } from '../opencodeConfig';\nimport type { AgentConfig, CategoryConfig } from '@/types/opencodeConfig';\n\nexport const PROFILES_DIR = join(homedir(), '.config', 'opencode', 'profiles');\nexport const PROFILE_INDEX_PATH = join(PROFILES_DIR, 'index.json');\n\nexport interface Profile {\n id: string;\n name: string;\n emoji: string;\n description?: string;\n createdAt: string;\n updatedAt: string;\n isDefault?: boolean;\n isBuiltIn?: boolean;\n}\n\nexport interface ProfileIndex {\n version: number;\n profiles: Profile[];\n activeProfileId: string | null;\n lastModified: string;\n}\n\nexport interface ProfileConfig {\n $schema?: string;\n agents: Record<string, AgentConfig>;\n categories?: Record<string, CategoryConfig>;\n}\n\nconst BUILTIN_PROFILES: Profile[] = [\n {\n id: 'balanced',\n name: 'Balanced',\n emoji: '⚖️',\n description: 'Balanced multi-model orchestration optimized for general coding tasks',\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n isBuiltIn: true,\n },\n];\n\nconst BUILTIN_PROFILE_CONFIGS: Record<string, ProfileConfig> = {\n balanced: {\n agents: {\n sisyphus: {\n model: 'anthropic/claude-opus-4-6',\n variant: 'max',\n temperature: 0.2,\n top_p: 0.9,\n },\n oracle: {\n model: 'openai/gpt-5.4',\n variant: 'high',\n temperature: 0.2,\n top_p: 0.9,\n },\n prometheus: {\n model: 'anthropic/claude-opus-4-6',\n variant: 'max',\n temperature: 0.2,\n top_p: 0.9,\n },\n metis: {\n model: 'anthropic/claude-opus-4-6',\n variant: 'max',\n temperature: 0.2,\n top_p: 0.9,\n },\n momus: {\n model: 'openai/gpt-5.4',\n variant: 'medium',\n temperature: 0.2,\n top_p: 0.9,\n },\n atlas: {\n model: 'anthropic/claude-sonnet-4-6',\n temperature: 0.2,\n top_p: 0.9,\n },\n hepheastus: {\n model: 'openai/gpt-5.3-codex',\n variant: 'xhigh',\n temperature: 0.2,\n top_p: 0.9,\n },\n librarian: {\n model: 'anthropic/claude-sonnet-4-6',\n temperature: 0.3,\n top_p: 0.9,\n },\n explore: {\n model: 'anthropic/claude-haiku-4-5',\n temperature: 0.1,\n top_p: 0.9,\n },\n 'multimodal-looker': {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n temperature: 0.2,\n top_p: 0.9,\n },\n 'frontend-ui-ux': {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n temperature: 0.3,\n top_p: 0.9,\n },\n },\n categories: {\n 'visual-engineering': {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n },\n ultrabrain: {\n model: 'openai/gpt-5.3-codex',\n variant: 'xhigh',\n },\n deep: {\n model: 'openai/gpt-5.3-codex',\n variant: 'medium',\n },\n artistry: {\n model: 'google/gemini-3.1-pro',\n variant: 'high',\n },\n quick: {\n model: 'anthropic/claude-haiku-4-5',\n temperature: 0.1,\n },\n 'unspecified-low': {\n model: 'anthropic/claude-sonnet-4-6',\n temperature: 0.2,\n },\n 'unspecified-high': {\n model: 'openai/gpt-5.4',\n variant: 'high',\n temperature: 0.2,\n },\n writing: {\n model: 'google/gemini-3-flash',\n temperature: 0.3,\n },\n },\n },\n};\n\nexport function ensureProfilesDir(): void {\n if (!existsSync(PROFILES_DIR)) {\n mkdirSync(PROFILES_DIR, { recursive: true });\n }\n}\n\nfunction getProfileConfigPath(id: string): string {\n return join(PROFILES_DIR, `${id}.json`);\n}\n\nfunction normalizeProfileConfig(config: unknown): ProfileConfig {\n if (!config || typeof config !== 'object') {\n return {\n $schema: OPEN_CODE_CONFIG_SCHEMA,\n agents: {},\n };\n }\n\n const candidate = config as Record<string, unknown>;\n const agents =\n candidate.agents && typeof candidate.agents === 'object'\n ? (candidate.agents as Record<string, AgentConfig>)\n : {};\n\n const categories =\n candidate.categories && typeof candidate.categories === 'object'\n ? (candidate.categories as Record<string, CategoryConfig>)\n : undefined;\n\n const schema =\n typeof candidate.$schema === 'string' && candidate.$schema.trim().length > 0\n ? candidate.$schema\n : OPEN_CODE_CONFIG_SCHEMA;\n\n return {\n $schema: schema,\n agents,\n categories,\n };\n}\n\nfunction createDefaultProfileIndex(): ProfileIndex {\n return {\n version: 1,\n profiles: [...BUILTIN_PROFILES],\n activeProfileId: null,\n lastModified: new Date().toISOString(),\n };\n}\n\nasync function createBuiltinProfileConfigs(): Promise<void> {\n const validBuiltinIds = new Set(BUILTIN_PROFILES.map(p => p.id));\n const deprecatedBuiltinIds = ['coding', 'writing', 'debug', 'minimal'];\n\n for (const deprecatedId of deprecatedBuiltinIds) {\n if (!validBuiltinIds.has(deprecatedId)) {\n const deprecatedConfigPath = getProfileConfigPath(deprecatedId);\n if (existsSync(deprecatedConfigPath)) {\n await unlink(deprecatedConfigPath);\n }\n }\n }\n\n for (const profile of BUILTIN_PROFILES) {\n const config = BUILTIN_PROFILE_CONFIGS[profile.id] || { agents: {} };\n await writeProfileConfig(profile.id, config);\n }\n}\n\nexport async function readProfileIndex(): Promise<ProfileIndex> {\n return readProfileIndexInternal(true);\n}\n\nexport async function readProfileIndexStrict(): Promise<ProfileIndex> {\n return readProfileIndexInternal(false);\n}\n\nasync function readProfileIndexInternal(fallbackOnError: boolean): Promise<ProfileIndex> {\n try {\n ensureProfilesDir();\n\n if (!existsSync(PROFILE_INDEX_PATH)) {\n const defaultIndex = createDefaultProfileIndex();\n await writeProfileIndex(defaultIndex);\n await createBuiltinProfileConfigs();\n return defaultIndex;\n }\n\n const content = await readFile(PROFILE_INDEX_PATH, 'utf-8');\n const index = parse(content, null, false) as unknown as ProfileIndex;\n \n // Ensure all built-in profiles exist in the index\n let modified = false;\n for (const builtinProfile of BUILTIN_PROFILES) {\n const exists = index.profiles.some(p => p.id === builtinProfile.id);\n if (!exists) {\n index.profiles.push(builtinProfile);\n modified = true;\n }\n }\n \n // Remove built-in profiles that are no longer in BUILTIN_PROFILES\n const builtinIds = new Set(BUILTIN_PROFILES.map(p => p.id));\n const oldLength = index.profiles.length;\n index.profiles = index.profiles.filter(p => !p.isBuiltIn || builtinIds.has(p.id));\n if (index.profiles.length !== oldLength) {\n modified = true;\n }\n \n await createBuiltinProfileConfigs();\n \n if (modified) {\n index.lastModified = new Date().toISOString();\n await writeProfileIndex(index);\n }\n \n return index;\n } catch (error) {\n if (!fallbackOnError) {\n throw error;\n }\n return createDefaultProfileIndex();\n }\n}\n\nexport async function writeProfileIndex(index: ProfileIndex): Promise<void> {\n ensureProfilesDir();\n \n index.lastModified = new Date().toISOString();\n const content = stringify(index, null, 2);\n \n await writeFile(PROFILE_INDEX_PATH, content, 'utf-8');\n}\n\n\nexport async function readProfileConfig(id: string): Promise<ProfileConfig> {\n try {\n const configPath = getProfileConfigPath(id);\n \n if (!existsSync(configPath)) {\n return {\n $schema: OPEN_CODE_CONFIG_SCHEMA,\n agents: {},\n };\n }\n\n const content = await readFile(configPath, 'utf-8');\n const parsedConfig = parse(content, null, false) as unknown;\n const normalizedConfig = normalizeProfileConfig(parsedConfig);\n\n if (\n !parsedConfig ||\n typeof parsedConfig !== 'object' ||\n typeof (parsedConfig as { $schema?: unknown }).$schema !== 'string'\n ) {\n try {\n await writeProfileConfig(id, normalizedConfig);\n } catch {\n return normalizedConfig;\n }\n }\n\n return normalizedConfig;\n } catch {\n return {\n $schema: OPEN_CODE_CONFIG_SCHEMA,\n agents: {},\n };\n }\n}\n\nexport async function writeProfileConfig(\n id: string, \n config: ProfileConfig\n): Promise<void> {\n ensureProfilesDir();\n\n const configPath = getProfileConfigPath(id);\n const content = stringify(normalizeProfileConfig(config), null, 2);\n\n await writeFile(configPath, content, 'utf-8');\n}\n\nexport async function deleteProfileConfig(id: string): Promise<boolean> {\n const index = await readProfileIndex();\n const profile = index.profiles.find(p => p.id === id);\n \n if (profile?.isBuiltIn) {\n const defaultConfig = BUILTIN_PROFILE_CONFIGS[id] || { agents: {} };\n await writeProfileConfig(id, defaultConfig);\n return true;\n }\n \n const configPath = getProfileConfigPath(id);\n \n if (!existsSync(configPath)) {\n return false;\n }\n \n await unlink(configPath);\n return true;\n}\n\nexport async function getProfileById(id: string): Promise<Profile | undefined> {\n const index = await readProfileIndex();\n return index.profiles.find(p => p.id === id);\n}\n\nexport async function getActiveProfileId(): Promise<string | null> {\n const index = await readProfileIndex();\n return index.activeProfileId;\n}\n\nexport async function setActiveProfileId(id: string | null): Promise<void> {\n const index = await readProfileIndex();\n index.activeProfileId = id;\n await writeProfileIndex(index);\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/profiles/route\",\n pathname: \"/api/profiles\",\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/profiles/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/profiles/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextRequest, NextResponse } from 'next/server';\nimport {\n readProfileIndex,\n writeProfileIndex,\n getProfileById,\n writeProfileConfig,\n} from '@/lib/profiles/storage';\nimport type { Profile, ProfileConfig } from '@/lib/profiles/storage';\n\nexport async function GET() {\n try {\n const index = await readProfileIndex();\n \n return NextResponse.json({\n profiles: index.profiles,\n activeProfileId: index.activeProfileId,\n });\n } catch (error) {\n console.error('Error reading profiles:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\n }\n}\n\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json();\n\n if (!body || typeof body !== 'object') {\n return NextResponse.json(\n { error: 'Invalid request body' },\n { status: 400 }\n );\n }\n\n // Support both { id, name, ... } and { profile: { id, name, ... }, config } formats\n const profileData = body.profile || body;\n const { id, name, emoji, description } = profileData;\n const config = body.config || profileData.config;\n\n if (!id || typeof id !== 'string' || id.trim() === '') {\n return NextResponse.json(\n { error: 'id is required and must be a non-empty string' },\n { status: 400 }\n );\n }\n\n if (!name || typeof name !== 'string' || name.trim() === '') {\n return NextResponse.json(\n { error: 'name is required and must be a non-empty string' },\n { status: 400 }\n );\n }\n\n const existingProfile = await getProfileById(id);\n if (existingProfile) {\n return NextResponse.json(\n { error: `Profile with id '${id}' already exists` },\n { status: 400 }\n );\n }\n\n if (!/^[a-zA-Z0-9_-]+$/.test(id)) {\n return NextResponse.json(\n { error: 'id must contain only letters, numbers, hyphens, and underscores' },\n { status: 400 }\n );\n }\n\n const now = new Date().toISOString();\n const newProfile: Profile = {\n id: id.trim(),\n name: name.trim(),\n emoji: emoji || '⚙️',\n description: description?.trim() || undefined,\n createdAt: now,\n updatedAt: now,\n };\n\n const index = await readProfileIndex();\n index.profiles.push(newProfile);\n await writeProfileIndex(index);\n\n if (config && typeof config === 'object') {\n const profileConfig: ProfileConfig = {\n agents: config.agents || {},\n categories: config.categories,\n };\n await writeProfileConfig(id, profileConfig);\n } else {\n await writeProfileConfig(id, { agents: {} });\n }\n\n return NextResponse.json(\n { profile: newProfile },\n { status: 201 }\n );\n } catch (error) {\n console.error('Error creating profile:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\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,OAGO,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,kCAchC,SAAS,EAAyB,CAAc,EACrD,IAAM,EAA6B,UAAjB,OAAO,GAAsB,AAAU,QAAQ,EAAC,MAAM,OAAO,CAAC,GAE5E,CAAC,EADD,CAAE,GAAI,CAAK,AAA6B,EAG5C,MAAO,CACL,GAAG,CAAS,CACZ,qBAVK,AAAU,CAUO,OAA8B,EAAU,oBAAoB,CAV3D,MAV0C,EAUlC,MAWjC,CACF,CAEO,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,AA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qB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,EACA,sBACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[2]}
@@ -0,0 +1,3 @@
1
+ module.exports=[81951,e=>{"use strict";e.s(["RUNTIME_ROLE_ENV_VAR",0,"VIBEPULSE_RUNTIME_ROLE"])},68817,e=>{"use strict";var t=e.i(81951);let r="x-vibepulse-node-version",n={unauthorized:401,unsupported_node_version:426,node_misconfigured:503,upstream_unreachable:503,upstream_timeout:504};function o(e){return"string"!=typeof e?null:e.trim()||null}function s(e,t){let n=new Headers(t);n.set(r,"1");let s=o(e??null);return s&&n.set("authorization",`Bearer ${s}`),n}function i(e,t){return{ok:!1,reason:e,protocolVersion:"1",..."node_misconfigured"===e||"upstream_unreachable"===e||"upstream_timeout"===e?{degraded:!0}:{},...t??{}}}function a(e,t){return Response.json(i(e,t),{status:n[e]})}function u(e){return Response.json(e.body,{status:e.status})}function l(e,s={}){if("node"!==(s.runtimeRole??s.env?.[t.RUNTIME_ROLE_ENV_VAR]??process.env[t.RUNTIME_ROLE_ENV_VAR]))return{ok:!1,status:n.node_misconfigured,body:i("node_misconfigured")};let a=o(s.expectedToken)??function(e=process.env){return o(e.VIBEPULSE_NODE_TOKEN)}(s.env??process.env);if("1"!==e.headers.get(r))return{ok:!1,status:n.unsupported_node_version,body:i("unsupported_node_version")};if(a){var u;let t,r=(u=e.headers.get("authorization"),t=u?.match(/^Bearer\s+(.+)$/i),o(t?.[1]));if(!r||r!==a)return{ok:!1,status:n.unauthorized,body:i("unauthorized")}}return{ok:!0}}e.s(["NODE_PROTOCOL_VERSION",0,"1","createNodeFailureResponse",()=>a,"createNodeRequestHeaders",()=>s,"guardNodeRequest",()=>l,"toNodeRequestGuardResponse",()=>u])},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 s(e){let t=e.deadlineMs-Date.now();return t<=0?(e.timedOut=!0,null):Math.max(1,Math.min(e.timeoutMs,t))}function i(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},u=i([...function(e){try{let r=s(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 s=t.match(/:(\d+)\s+\(LISTEN\)/);if(!s)continue;let i=parseInt(s[1],10);Number.isFinite(i)&&o.push(i)}return o}catch(t){return o(t)&&(e.timedOut=!0),[]}}(a),...function(e){try{let r=s(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 u)r.add(e);return{ports:i([...u,...Array.from(r)]),timedOut:a.timedOut}}function u(){let e=n(),r={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},i=function(e){try{let r=s(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),s=r[2];Number.isFinite(n)&&/\bopencode\b/.test(s)&&(/\b--port(?:=|\s+)\d+\b/.test(s)||o.push(n))}return Array.from(new Set(o))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(r);if(!i.length)return{processes:[],timedOut:r.timedOut};let a=[],u=new Set;for(let e of i){let n=function(e,r){try{let n=s(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 i=`${e}:${n}`;u.has(i)||(u.add(i),a.push({pid:e,cwd:n}))}return{processes:a,timedOut:r.timedOut}}e.s(["discoverOpencodePortsWithMeta",()=>a,"discoverOpencodeProcessCwdsWithoutPortWithMeta",()=>u])},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 s(e,r=Date.now()){let n=t.get(e);t.set(e,{markedAt:n?.markedAt??r,lastSeenAt:r}),o(r)}function i(e){t.delete(e)}function a(e,t=Date.now()){r.set(e,t),n(t)}function u(e){r.delete(e)}function l(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",()=>i,"clearSessionStickyStatusBlocked",()=>u,"markSessionForceUnarchived",()=>s,"markSessionStickyStatusBlocked",()=>a,"pruneSessionForceUnarchived",()=>p,"pruneSessionStickyStatusBlocked",()=>d,"shouldForceSessionUnarchived",()=>c,"takeSessionStickyStatusBlocked",()=>l])},69917,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),s=e.i(61916),i=e.i(74677),a=e.i(69741),u=e.i(16795),l=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),R=e.i(93695);e.i(52474);var v=e.i(220),g=e.i(99686),x=e.i(68817),E=e.i(74579);async function w(e,{params:t}){let r,n,o=(0,x.guardNodeRequest)(e);if(!o.ok)return(0,x.toNodeRequestGuardResponse)(o);let{id:s}=await t,i=!(n=s.trim())||n.includes(":")?null:n;if(!i)return Response.json({error:"Invalid node session id"},{status:400});let{ports:a,timedOut:u}=(0,g.discoverOpencodePortsWithMeta)();if(!a.length)return(0,x.createNodeFailureResponse)(u?"upstream_timeout":"upstream_unreachable",{role:"node",upstream:{kind:"opencode",reachable:!1}});let l=null;for(let e of a)try{let t=await fetch(`http://localhost:${e}/session/${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({time:{archived:Date.now()}})});if(t.ok)return(0,E.clearSessionForceUnarchived)(i),(0,E.markSessionStickyStatusBlocked)(i),Response.json({success:!0});if(404===t.status)continue;l=t.status,r=await t.text().catch(()=>"")||void 0}catch(e){l=503,r=e instanceof Error?e.message:String(e)}return null!==l?Response.json({error:"Failed to archive session",reason:503===l?"upstream_unreachable":`node_request_failed_${l}`,...r?{message:r}:{}},{status:l}):Response.json({error:"Session not found",reason:"session_not_found"},{status:404})}e.s(["POST",()=>w,"dynamic",0,"force-dynamic"],86580);var y=e.i(86580);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/node/sessions/[id]/archive/route",pathname:"/api/node/sessions/[id]/archive",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/node/sessions/[id]/archive/route.ts",nextConfigOutput:"standalone",userland:y}),{workAsyncStorage:_,workUnitAsyncStorage:O,serverHooks:b}=S;function N(){return(0,n.patchFetch)({workAsyncStorage:_,workUnitAsyncStorage:O})}async function k(e,t,n){S.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/node/sessions/[id]/archive/route";g=g.replace(/\/index$/,"")||"/";let x=await S.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!x)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:_,isDraftMode:O,prerenderManifest:b,routerServerContext:N,isOnDemandRevalidate:k,revalidateOnlyGenerated:A,resolvedPathname:C,clientReferenceManifest:T,serverActionsManifest:P}=x,I=(0,a.normalizeAppPath)(g),M=!!(b.dynamicRoutes[I]||b.routes[C]),D=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,_,!1):t.end("This page could not be found"),null);if(M&&!O){let e=!!b.routes[C],t=b.dynamicRoutes[I];if(t&&!1===t.fallback&&!e){if(y.experimental.adapterPath)return await D();throw new R.NoFallbackError}}let U=null;!M||S.isDev||O||(U="/index"===(U=C)?"/":U);let q=!0===S.isDev||!M,j=M&&!q;P&&T&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:T,serverActionsManifest:P});let F=e.method||"GET",H=(0,s.getTracer)(),$=H.getActiveScopeSpan(),L={params:w,prerenderManifest:b,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)=>S.onRequestError(e,t,n,o,N)},sharedContext:{buildId:E}},B=new u.NodeNextRequest(e),V=new u.NodeNextResponse(t),z=l.NextRequestAdapter.fromNodeNextRequest(B,(0,l.signalFromNodeResponse)(t));try{let i=async e=>S.handle(z,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.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} ${g}`)}),a=!!(0,o.getRequestMeta)(e,"minimalMode"),u=async o=>{var s,u;let l=async({previousCacheEntry:r})=>{try{if(!a&&k&&A&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(o);e.fetchMetrics=L.renderOpts.fetchMetrics;let u=L.renderOpts.pendingWaitUntil;u&&n.waitUntil&&(n.waitUntil(u),u=void 0);let l=L.renderOpts.collectedTags;if(!M)return await (0,p.sendResponse)(B,V,s,L.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,n=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await S.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:k})},!1,N),t}},d=await S.handleResponse({req:e,nextConfig:y,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:A,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:a});if(!M)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(u=d.value)?void 0:u.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"),O&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let R=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return a&&M||R.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||R.get("Cache-Control")||R.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(B,V,new Response(d.value.body,{headers:R,status:d.value.status||200})),null};$?await u($):await H.withPropagatedContext(e.headers,()=>H.trace(d.BaseServerSpan.handleRequest,{spanName:`${F} ${g}`,kind:s.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},u))}catch(t){if(t instanceof R.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:k})},!1,N),M)throw t;return await (0,p.sendResponse)(B,V,new Response(null,{status:500})),null}}e.s(["handler",()=>k,"patchFetch",()=>N,"routeModule",()=>S,"serverHooks",()=>b,"workAsyncStorage",()=>_,"workUnitAsyncStorage",()=>O],69917)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__d8e61048._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/runtimeMode.ts","../../../src/lib/nodeProtocol.ts","../../../src/lib/opencodeDiscovery.ts","../../../src/lib/sessionArchiveOverrides.ts","../../../src/app/api/node/sessions/%5Bid%5D/archive/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 { RUNTIME_ROLE_ENV_VAR } from '@/lib/runtimeMode';\n\nexport const NODE_PROTOCOL_VERSION_HEADER = 'x-vibepulse-node-version';\nexport const NODE_PROTOCOL_VERSION = '1';\nexport const NODE_SHARED_TOKEN_ENV_VAR = 'VIBEPULSE_NODE_TOKEN';\n\nexport type NodeFailureReason =\n | 'unauthorized'\n | 'unsupported_node_version'\n | 'node_misconfigured'\n | 'upstream_unreachable'\n | 'upstream_timeout';\n\nexport interface NodeFailurePayload {\n ok: false;\n reason: NodeFailureReason;\n protocolVersion: typeof NODE_PROTOCOL_VERSION;\n degraded?: boolean;\n [key: string]: unknown;\n}\n\nexport type NodeRequestGuardFailure = {\n ok: false;\n status: number;\n body: NodeFailurePayload;\n};\n\nexport type NodeRequestGuardResult =\n | { ok: true }\n | NodeRequestGuardFailure;\n\nexport interface NodeRequestGuardOptions {\n runtimeRole?: string | undefined;\n expectedToken?: string | undefined;\n env?: NodeJS.ProcessEnv;\n}\n\nconst NODE_FAILURE_STATUS: Record<NodeFailureReason, number> = {\n unauthorized: 401,\n unsupported_node_version: 426,\n node_misconfigured: 503,\n upstream_unreachable: 503,\n upstream_timeout: 504,\n};\n\nfunction trimToNull(value: string | null | undefined): string | null {\n if (typeof value !== 'string') {\n return null;\n }\n\n const trimmed = value.trim();\n return trimmed ? trimmed : null;\n}\n\nfunction readBearerToken(authorizationHeader: string | null): string | null {\n const match = authorizationHeader?.match(/^Bearer\\s+(.+)$/i);\n return trimToNull(match?.[1]);\n}\n\nfunction isDegradedReason(reason: NodeFailureReason): boolean {\n return reason === 'node_misconfigured' || reason === 'upstream_unreachable' || reason === 'upstream_timeout';\n}\n\nexport function getConfiguredNodeToken(env: NodeJS.ProcessEnv = process.env): string | null {\n return trimToNull(env[NODE_SHARED_TOKEN_ENV_VAR]);\n}\n\nexport function createNodeRequestHeaders(token?: string | null, headers?: HeadersInit): Headers {\n const requestHeaders = new Headers(headers);\n requestHeaders.set(NODE_PROTOCOL_VERSION_HEADER, NODE_PROTOCOL_VERSION);\n\n const trimmedToken = trimToNull(token ?? null);\n if (trimmedToken) {\n requestHeaders.set('authorization', `Bearer ${trimmedToken}`);\n }\n\n return requestHeaders;\n}\n\nexport function createNodeFailurePayload(\n reason: NodeFailureReason,\n extras?: Record<string, unknown>\n): NodeFailurePayload {\n return {\n ok: false,\n reason,\n protocolVersion: NODE_PROTOCOL_VERSION,\n ...(isDegradedReason(reason) ? { degraded: true } : {}),\n ...(extras ?? {}),\n };\n}\n\nexport function createNodeFailureResponse(\n reason: NodeFailureReason,\n extras?: Record<string, unknown>\n): Response {\n return Response.json(createNodeFailurePayload(reason, extras), {\n status: NODE_FAILURE_STATUS[reason],\n });\n}\n\nexport function toNodeRequestGuardResponse(failure: NodeRequestGuardFailure): Response {\n return Response.json(failure.body, { status: failure.status });\n}\n\nexport function guardNodeRequest(\n request: Request,\n options: NodeRequestGuardOptions = {}\n): NodeRequestGuardResult {\n const runtimeRole = options.runtimeRole ?? options.env?.[RUNTIME_ROLE_ENV_VAR] ?? process.env[RUNTIME_ROLE_ENV_VAR];\n if (runtimeRole !== 'node') {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.node_misconfigured,\n body: createNodeFailurePayload('node_misconfigured'),\n };\n }\n\n const expectedToken = trimToNull(options.expectedToken) ?? getConfiguredNodeToken(options.env ?? process.env);\n\n const version = request.headers.get(NODE_PROTOCOL_VERSION_HEADER);\n if (version !== NODE_PROTOCOL_VERSION) {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.unsupported_node_version,\n body: createNodeFailurePayload('unsupported_node_version'),\n };\n }\n\n if (expectedToken) {\n const presentedToken = readBearerToken(request.headers.get('authorization'));\n if (!presentedToken || presentedToken !== expectedToken) {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.unauthorized,\n body: createNodeFailurePayload('unauthorized'),\n };\n }\n }\n\n return { ok: true };\n}\n","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","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 {\n createNodeFailureResponse,\n guardNodeRequest,\n toNodeRequestGuardResponse,\n} from '@/lib/nodeProtocol';\nimport {\n clearSessionForceUnarchived,\n markSessionStickyStatusBlocked,\n} from '@/lib/sessionArchiveOverrides';\n\nfunction resolveNodeLocalSessionId(id: string): string | null {\n const trimmedId = id.trim();\n if (!trimmedId || trimmedId.includes(':')) {\n return null;\n }\n\n return trimmedId;\n}\n\nexport const dynamic = 'force-dynamic';\n\nexport async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) {\n const guardResult = guardNodeRequest(request);\n if (!guardResult.ok) {\n return toNodeRequestGuardResponse(guardResult);\n }\n\n const { id } = await params;\n const sessionId = resolveNodeLocalSessionId(id);\n\n if (!sessionId) {\n return Response.json({ error: 'Invalid node session id' }, { status: 400 });\n }\n\n const { ports, timedOut } = discoverOpencodePortsWithMeta();\n if (!ports.length) {\n return createNodeFailureResponse(timedOut ? 'upstream_timeout' : 'upstream_unreachable', {\n role: 'node',\n upstream: {\n kind: 'opencode',\n reachable: false,\n },\n });\n }\n\n let sawNotFound = false;\n let lastFailureStatus: number | null = null;\n let lastFailureMessage: string | undefined;\n\n for (const port of ports) {\n try {\n const response = await fetch(`http://localhost:${port}/session/${sessionId}`, {\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ time: { archived: Date.now() } }),\n });\n\n if (response.ok) {\n clearSessionForceUnarchived(sessionId);\n markSessionStickyStatusBlocked(sessionId);\n return Response.json({ success: true });\n }\n\n if (response.status === 404) {\n sawNotFound = true;\n continue;\n }\n\n lastFailureStatus = response.status;\n const responseBody = await response.text().catch(() => '');\n lastFailureMessage = responseBody || undefined;\n } catch (error) {\n lastFailureStatus = 503;\n lastFailureMessage = error instanceof Error ? error.message : String(error);\n }\n }\n\n if (lastFailureStatus !== null) {\n return Response.json(\n {\n error: 'Failed to archive session',\n reason: lastFailureStatus === 503 ? 'upstream_unreachable' : `node_request_failed_${lastFailureStatus}`,\n ...(lastFailureMessage ? { message: lastFailureMessage } : {}),\n },\n { status: lastFailureStatus }\n );\n }\n\n if (sawNotFound) {\n return Response.json({ error: 'Session not found', reason: 'session_not_found' }, { status: 404 });\n }\n\n return Response.json({ error: 'Session not found', reason: 'session_not_found' }, { status: 404 });\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/node/sessions/[id]/archive/route\",\n pathname: \"/api/node/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/node/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/node/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":"qEACoC,mDCDpC,IAAA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAA+B,2BAmCtC,EAAyD,CAC7D,aAAc,IACd,yBAA0B,IAC1B,mBAAoB,IACpB,qBAAsB,IACtB,iBAAkB,GACpB,EAEA,SAAS,EAAW,CAAgC,QAClD,AAAqB,UAAjB,AAA2B,OAApB,EACF,KAIF,AADS,EAAM,IAAI,IACT,AAAU,IAC7B,CAeO,SAAS,EAAyB,CAAqB,CAAE,CAAqB,EACnF,IAAM,EAAiB,IAAI,QAAQ,GACnC,EAAe,GAAG,CAAC,O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,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[5]}
@@ -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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},57181,e=>{"use strict";var t=e.i(24868),r=e.i(22734),n=e.i(14747),o=e.i(46786),i=e.i(89196);let s=(0,n.join)((0,o.homedir)(),".config","opencode"),u=(0,n.join)(s,"oh-my-opencode.jsonc"),a="https://opencode.ai/config.json";function c(e){let t="object"!=typeof e||null===e||Array.isArray(e)?{}:{...e};return{...t,openEditorTargetMode:"hub"===t.openEditorTargetMode?"hub":"remote"}}function l(e=u){try{return(0,r.existsSync)(e)}catch{return!1}}async function d(e=u){try{let r=await (0,t.readFile)(e,"utf-8");return(0,i.parse)(r,null,!1)}catch{return{}}}async function f(e,o=u){try{let s=(0,n.join)(o,"..");(0,r.existsSync)(s)||(0,r.mkdirSync)(s,{recursive:!0});let c=o===u?{...e,$schema:e.$schema||a}:e,l=(0,i.stringify)(c,null,2);await (0,t.writeFile)(o,l,"utf-8")}catch(e){throw Error(`Failed to write config: ${e}`)}}e.s(["CONFIG_PATH",0,u,"OPEN_CODE_CONFIG_SCHEMA",0,a,"detectConfig",()=>l,"normalizeVibePulseConfig",()=>c,"readConfig",()=>d,"writeConfig",()=>f])},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}}function n(e){if("string"!=typeof e)throw Error("Invalid action session id: must be a string");let t=e.trim();if(""===t)throw Error("Invalid action session id: cannot be empty");if(!t.includes(":"))return{hostId:"local",sessionId:t,isRemote:!1};let{hostId:n,sessionId:o}=r(t);return{hostId:n,sessionId:o,isRemote:"local"!==n}}function o(e){try{let t=n(e);return t.isRemote?null:t.sessionId}catch{return null}}e.s(["composeSourceKey",()=>t,"parseActionSessionReference",()=>n,"parseSourceKey",()=>r,"resolveLocalActionSessionId",()=>o])},81951,e=>{"use strict";e.s(["RUNTIME_ROLE_ENV_VAR",0,"VIBEPULSE_RUNTIME_ROLE"])},68817,e=>{"use strict";var t=e.i(81951);let r="x-vibepulse-node-version",n={unauthorized:401,unsupported_node_version:426,node_misconfigured:503,upstream_unreachable:503,upstream_timeout:504};function o(e){return"string"!=typeof e?null:e.trim()||null}function i(e,t){let n=new Headers(t);n.set(r,"1");let i=o(e??null);return i&&n.set("authorization",`Bearer ${i}`),n}function s(e,t){return{ok:!1,reason:e,protocolVersion:"1",..."node_misconfigured"===e||"upstream_unreachable"===e||"upstream_timeout"===e?{degraded:!0}:{},...t??{}}}function u(e,t){return Response.json(s(e,t),{status:n[e]})}function a(e){return Response.json(e.body,{status:e.status})}function c(e,i={}){if("node"!==(i.runtimeRole??i.env?.[t.RUNTIME_ROLE_ENV_VAR]??process.env[t.RUNTIME_ROLE_ENV_VAR]))return{ok:!1,status:n.node_misconfigured,body:s("node_misconfigured")};let u=o(i.expectedToken)??function(e=process.env){return o(e.VIBEPULSE_NODE_TOKEN)}(i.env??process.env);if("1"!==e.headers.get(r))return{ok:!1,status:n.unsupported_node_version,body:s("unsupported_node_version")};if(u){var a;let t,r=(a=e.headers.get("authorization"),t=a?.match(/^Bearer\s+(.+)$/i),o(t?.[1]));if(!r||r!==u)return{ok:!1,status:n.unauthorized,body:s("unauthorized")}}return{ok:!0}}e.s(["NODE_PROTOCOL_VERSION",0,"1","createNodeFailureResponse",()=>u,"createNodeRequestHeaders",()=>i,"guardNodeRequest",()=>c,"toNodeRequestGuardResponse",()=>a])},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 u(){let e=n(),u={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},a=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),[]}}(u),...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),[]}}(u)]);for(let e of a)r.add(e);return{ports:s([...a,...Array.from(r)]),timedOut:u.timedOut}}function a(){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 u=[],a=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}`;a.has(s)||(a.add(s),u.push({pid:e,cwd:n}))}return{processes:u,timedOut:r.timedOut}}e.s(["discoverOpencodePortsWithMeta",()=>u,"discoverOpencodeProcessCwdsWithoutPortWithMeta",()=>a])},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 u(e,t=Date.now()){r.set(e,t),n(t)}function a(e){r.delete(e)}function c(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 l(e=Date.now()){n(e)}function d(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 f(e=Date.now()){o(e)}e.s(["clearSessionForceUnarchived",()=>s,"clearSessionStickyStatusBlocked",()=>a,"markSessionForceUnarchived",()=>i,"markSessionStickyStatusBlocked",()=>u,"pruneSessionForceUnarchived",()=>f,"pruneSessionStickyStatusBlocked",()=>l,"shouldForceSessionUnarchived",()=>d,"takeSessionStickyStatusBlocked",()=>c])}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__db285678._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/opencodeConfig.ts","../../../src/lib/hostIdentity.ts","../../../src/lib/runtimeMode.ts","../../../src/lib/nodeProtocol.ts","../../../src/lib/opencodeDiscovery.ts","../../../src/lib/sessionArchiveOverrides.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';\nimport type { OpenEditorTargetMode, VibePulseConfig } from '@/types/opencodeConfig';\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';\nexport const DEFAULT_OPEN_EDITOR_TARGET_MODE: OpenEditorTargetMode = 'remote';\n\nexport type OpenCodeConfig = {\n $schema?: string;\n agents?: Record<string, unknown>;\n vibepulse?: VibePulseConfig;\n [key: string]: unknown;\n};\n\nexport function normalizeOpenEditorTargetMode(value: unknown): OpenEditorTargetMode {\n return value === 'hub' ? 'hub' : DEFAULT_OPEN_EDITOR_TARGET_MODE;\n}\n\nexport function normalizeVibePulseConfig(value: unknown): VibePulseConfig {\n const vibepulse = typeof value === 'object' && value !== null && !Array.isArray(value)\n ? { ...(value as Record<string, unknown>) }\n : {};\n\n return {\n ...vibepulse,\n openEditorTargetMode: normalizeOpenEditorTargetMode(vibepulse.openEditorTargetMode),\n };\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","/**\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\nexport interface ActionSessionReference {\n hostId: string;\n sessionId: string;\n isRemote: boolean;\n}\n\nexport function parseActionSessionReference(value: string): ActionSessionReference {\n if (typeof value !== 'string') {\n throw new Error('Invalid action session id: must be a string');\n }\n\n const trimmedValue = value.trim();\n if (trimmedValue === '') {\n throw new Error('Invalid action session id: cannot be empty');\n }\n\n if (!trimmedValue.includes(':')) {\n return {\n hostId: 'local',\n sessionId: trimmedValue,\n isRemote: false,\n };\n }\n\n const { hostId, sessionId } = parseSourceKey(trimmedValue);\n return {\n hostId,\n sessionId,\n isRemote: hostId !== 'local',\n };\n}\n\nexport function resolveLocalActionSessionId(value: string): string | null {\n try {\n const reference = parseActionSessionReference(value);\n return reference.isRemote ? null : reference.sessionId;\n } catch {\n return null;\n }\n}\n","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 { RUNTIME_ROLE_ENV_VAR } from '@/lib/runtimeMode';\n\nexport const NODE_PROTOCOL_VERSION_HEADER = 'x-vibepulse-node-version';\nexport const NODE_PROTOCOL_VERSION = '1';\nexport const NODE_SHARED_TOKEN_ENV_VAR = 'VIBEPULSE_NODE_TOKEN';\n\nexport type NodeFailureReason =\n | 'unauthorized'\n | 'unsupported_node_version'\n | 'node_misconfigured'\n | 'upstream_unreachable'\n | 'upstream_timeout';\n\nexport interface NodeFailurePayload {\n ok: false;\n reason: NodeFailureReason;\n protocolVersion: typeof NODE_PROTOCOL_VERSION;\n degraded?: boolean;\n [key: string]: unknown;\n}\n\nexport type NodeRequestGuardFailure = {\n ok: false;\n status: number;\n body: NodeFailurePayload;\n};\n\nexport type NodeRequestGuardResult =\n | { ok: true }\n | NodeRequestGuardFailure;\n\nexport interface NodeRequestGuardOptions {\n runtimeRole?: string | undefined;\n expectedToken?: string | undefined;\n env?: NodeJS.ProcessEnv;\n}\n\nconst NODE_FAILURE_STATUS: Record<NodeFailureReason, number> = {\n unauthorized: 401,\n unsupported_node_version: 426,\n node_misconfigured: 503,\n upstream_unreachable: 503,\n upstream_timeout: 504,\n};\n\nfunction trimToNull(value: string | null | undefined): string | null {\n if (typeof value !== 'string') {\n return null;\n }\n\n const trimmed = value.trim();\n return trimmed ? trimmed : null;\n}\n\nfunction readBearerToken(authorizationHeader: string | null): string | null {\n const match = authorizationHeader?.match(/^Bearer\\s+(.+)$/i);\n return trimToNull(match?.[1]);\n}\n\nfunction isDegradedReason(reason: NodeFailureReason): boolean {\n return reason === 'node_misconfigured' || reason === 'upstream_unreachable' || reason === 'upstream_timeout';\n}\n\nexport function getConfiguredNodeToken(env: NodeJS.ProcessEnv = process.env): string | null {\n return trimToNull(env[NODE_SHARED_TOKEN_ENV_VAR]);\n}\n\nexport function createNodeRequestHeaders(token?: string | null, headers?: HeadersInit): Headers {\n const requestHeaders = new Headers(headers);\n requestHeaders.set(NODE_PROTOCOL_VERSION_HEADER, NODE_PROTOCOL_VERSION);\n\n const trimmedToken = trimToNull(token ?? null);\n if (trimmedToken) {\n requestHeaders.set('authorization', `Bearer ${trimmedToken}`);\n }\n\n return requestHeaders;\n}\n\nexport function createNodeFailurePayload(\n reason: NodeFailureReason,\n extras?: Record<string, unknown>\n): NodeFailurePayload {\n return {\n ok: false,\n reason,\n protocolVersion: NODE_PROTOCOL_VERSION,\n ...(isDegradedReason(reason) ? { degraded: true } : {}),\n ...(extras ?? {}),\n };\n}\n\nexport function createNodeFailureResponse(\n reason: NodeFailureReason,\n extras?: Record<string, unknown>\n): Response {\n return Response.json(createNodeFailurePayload(reason, extras), {\n status: NODE_FAILURE_STATUS[reason],\n });\n}\n\nexport function toNodeRequestGuardResponse(failure: NodeRequestGuardFailure): Response {\n return Response.json(failure.body, { status: failure.status });\n}\n\nexport function guardNodeRequest(\n request: Request,\n options: NodeRequestGuardOptions = {}\n): NodeRequestGuardResult {\n const runtimeRole = options.runtimeRole ?? options.env?.[RUNTIME_ROLE_ENV_VAR] ?? process.env[RUNTIME_ROLE_ENV_VAR];\n if (runtimeRole !== 'node') {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.node_misconfigured,\n body: createNodeFailurePayload('node_misconfigured'),\n };\n }\n\n const expectedToken = trimToNull(options.expectedToken) ?? getConfiguredNodeToken(options.env ?? process.env);\n\n const version = request.headers.get(NODE_PROTOCOL_VERSION_HEADER);\n if (version !== NODE_PROTOCOL_VERSION) {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.unsupported_node_version,\n body: createNodeFailurePayload('unsupported_node_version'),\n };\n }\n\n if (expectedToken) {\n const presentedToken = readBearerToken(request.headers.get('authorization'));\n if (!presentedToken || presentedToken !== expectedToken) {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.unauthorized,\n body: createNodeFailurePayload('unauthorized'),\n };\n }\n }\n\n return { ok: true };\n}\n","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","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"],"names":[],"mappings":"23BAAA,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,OAGO,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,kCAchC,SAAS,EAAyB,CAAc,EACrD,IAAM,EAA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iB,EAC3D,EAA0B,MAAM,CAAC,EACnC,CAEO,SAAS,EAA+B,CAAiB,CAAE,EAAc,KAAK,GAAG,EAAE,EACxF,EAA8B,GAAG,CAAC,EAAW,GAC7C,EAAwB,EAC1B,CAEO,SAAS,EAAgC,CAAiB,EAC/D,EAA8B,MAAM,CAAC,EACvC,CAEO,SAAS,EAA+B,CAAiB,CAAE,EAAc,KAAK,GAAG,EAAE,EACxF,IAAM,EAAW,EAA8B,GAAG,CAAC,SACnD,AAAwB,UAApB,AAA8B,OAAvB,IAIP,EAAM,EAnF6B,KAAK,AAoF1C,EAA8B,EADX,CAnF4B,GAoFX,CAAC,IAC9B,IAGT,EAA8B,MAAM,CAAC,GAC9B,IACT,CAEO,IATkD,KASzC,EAAgC,EAAc,KAAK,GAAG,EAAE,EACtE,EAAwB,EAC1B,CAEO,SAAS,EAA6B,CAAiB,CAAE,EAAc,KAAK,GAAG,EAAE,EACtF,IAAM,EAAQ,EAA0B,GAAG,CAAC,SAC5C,CAAI,CAAC,IAED,EAAM,CAFE,CAEI,MAFG,EAEK,CArGW,EAqGR,GArGa,IAsGtC,CAtG2C,CAsGjB,IAtGsB,EAsGhB,CAAC,EAtGoB,EAuG9C,IAGT,EAA0B,GAAG,CAL4B,AAK3B,EAAW,CACvC,GAAG,CAAK,CACR,WAAY,CACd,IACO,GACT,CAEO,SAAS,EAA4B,EAAc,KAAK,GAAG,EAAE,EAClE,EAAW,EACb"}
@@ -1,5 +1,5 @@
1
- module.exports=[68817,e=>{"use strict";var t=e.i(81951);let r="x-vibepulse-node-version",n={unauthorized:401,unsupported_node_version:426,node_misconfigured:503,upstream_unreachable:503,upstream_timeout:504};function o(e){return"string"!=typeof e?null:e.trim()||null}function a(e,t){let n=new Headers(t);n.set(r,"1");let a=o(e??null);return a&&n.set("authorization",`Bearer ${a}`),n}function i(e,t){return{ok:!1,reason:e,protocolVersion:"1",..."node_misconfigured"===e||"upstream_unreachable"===e||"upstream_timeout"===e?{degraded:!0}:{},...t??{}}}function s(e,t){return Response.json(i(e,t),{status:n[e]})}function l(e){return Response.json(e.body,{status:e.status})}function u(e,a={}){if("node"!==(a.runtimeRole??a.env?.[t.RUNTIME_ROLE_ENV_VAR]??process.env[t.RUNTIME_ROLE_ENV_VAR]))return{ok:!1,status:n.node_misconfigured,body:i("node_misconfigured")};let s=o(a.expectedToken)??function(e=process.env){return o(e.VIBEPULSE_NODE_TOKEN)}(a.env??process.env);if("1"!==e.headers.get(r))return{ok:!1,status:n.unsupported_node_version,body:i("unsupported_node_version")};if(s){var l;let t,r=(l=e.headers.get("authorization"),t=l?.match(/^Bearer\s+(.+)$/i),o(t?.[1]));if(!r||r!==s)return{ok:!1,status:n.unauthorized,body:i("unauthorized")}}return{ok:!0}}e.s(["NODE_PROTOCOL_VERSION",0,"1","createNodeFailureResponse",()=>s,"createNodeRequestHeaders",()=>a,"guardNodeRequest",()=>u,"toNodeRequestGuardResponse",()=>l])},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 a(e){let t=e.deadlineMs-Date.now();return t<=0?(e.timedOut=!0,null):Math.max(1,Math.min(e.timeoutMs,t))}function i(e){return Array.from(new Set(e.filter(e=>Number.isInteger(e)&&e>0&&e<=65535))).sort((e,t)=>e-t)}function s(){let e=n(),s={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},l=i([...function(e){try{let r=a(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 a=t.match(/:(\d+)\s+\(LISTEN\)/);if(!a)continue;let i=parseInt(a[1],10);Number.isFinite(i)&&o.push(i)}return o}catch(t){return o(t)&&(e.timedOut=!0),[]}}(s),...function(e){try{let r=a(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),[]}}(s)]);for(let e of l)r.add(e);return{ports:i([...l,...Array.from(r)]),timedOut:s.timedOut}}function l(){let e=n(),r={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},i=function(e){try{let r=a(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),a=r[2];Number.isFinite(n)&&/\bopencode\b/.test(a)&&(/\b--port(?:=|\s+)\d+\b/.test(a)||o.push(n))}return Array.from(new Set(o))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(r);if(!i.length)return{processes:[],timedOut:r.timedOut};let s=[],l=new Set;for(let e of i){let n=function(e,r){try{let n=a(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 i=`${e}:${n}`;l.has(i)||(l.add(i),s.push({pid:e,cwd:n}))}return{processes:s,timedOut:r.timedOut}}e.s(["discoverOpencodePortsWithMeta",()=>s,"discoverOpencodeProcessCwdsWithoutPortWithMeta",()=>l])},81951,e=>{"use strict";e.s(["RUNTIME_ROLE_ENV_VAR",0,"VIBEPULSE_RUNTIME_ROLE"])},58975,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),a=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),m=e.i(70101),f=e.i(26937),h=e.i(10372),v=e.i(93695);e.i(52474);var R=e.i(220);e.i(39354);var E=e.i(34959),g=e.i(99686),y=e.i(68817);let w={hostId:"local",hostLabel:"Local",hostKind:"local"};function x(e){return(e instanceof Error?e.message:String(e)).toLowerCase().includes("timed out")}function b(e){return(0,y.createNodeFailureResponse)(e,{role:"node",source:w,upstream:{kind:"opencode",reachable:!1}})}async function O(e,t,r){let n=r??new AbortController,o=(0,E.createOpencodeClient)({baseUrl:`http://localhost:${e}`}),a=null,i=new Promise((r,o)=>{a=setTimeout(()=>{n.abort(),o(Error(`OpenCode event stream preflight timed out for port ${e} after ${t}ms`))},t)});try{let t=await Promise.race([o.global.event({signal:n.signal}),i]);return{port:e,stream:t.stream,controller:n}}finally{a&&clearTimeout(a)}}async function _(e){let t=(0,y.guardNodeRequest)(e);if(!t.ok)return(0,y.toNodeRequestGuardResponse)(t);let{ports:r,timedOut:n}=(0,g.discoverOpencodePortsWithMeta)();if(!r.length)return b(n?"upstream_timeout":"upstream_unreachable");try{let t,n=new TextEncoder,o=(t=Number(process.env.OPENCODE_EVENTS_PREFLIGHT_TIMEOUT_MS),Number.isFinite(t)&&t>0?t:2500),a=new Map,i=r.map(e=>{let t=new AbortController;return a.set(e,t),O(e,o,t)}),s=await Promise.any(i).catch(async()=>{for(let e of(await Promise.allSettled(i)))"rejected"===e.status&&console.warn("Failed to connect to node-local OpenCode port during preflight:",e.reason);return null});if(!s){let e=(await Promise.allSettled(i)).filter(e=>"rejected"===e.status).map(e=>e.reason);return b(e.length>0&&e.every(x)?"upstream_timeout":"upstream_unreachable")}for(let[e,t]of a.entries())e!==s.port&&t.abort();let l=null,u=new ReadableStream({async start(t){let a=!1,i=new Set([s.controller]),u=new Set,d=e=>{try{return t.enqueue(n.encode(`data: ${JSON.stringify({role:"node",protocolVersion:y.NODE_PROTOCOL_VERSION,source:w,event:e})}
1
+ module.exports=[81951,e=>{"use strict";e.s(["RUNTIME_ROLE_ENV_VAR",0,"VIBEPULSE_RUNTIME_ROLE"])},68817,e=>{"use strict";var t=e.i(81951);let r="x-vibepulse-node-version",n={unauthorized:401,unsupported_node_version:426,node_misconfigured:503,upstream_unreachable:503,upstream_timeout:504};function o(e){return"string"!=typeof e?null:e.trim()||null}function a(e,t){let n=new Headers(t);n.set(r,"1");let a=o(e??null);return a&&n.set("authorization",`Bearer ${a}`),n}function i(e,t){return{ok:!1,reason:e,protocolVersion:"1",..."node_misconfigured"===e||"upstream_unreachable"===e||"upstream_timeout"===e?{degraded:!0}:{},...t??{}}}function s(e,t){return Response.json(i(e,t),{status:n[e]})}function l(e){return Response.json(e.body,{status:e.status})}function u(e,a={}){if("node"!==(a.runtimeRole??a.env?.[t.RUNTIME_ROLE_ENV_VAR]??process.env[t.RUNTIME_ROLE_ENV_VAR]))return{ok:!1,status:n.node_misconfigured,body:i("node_misconfigured")};let s=o(a.expectedToken)??function(e=process.env){return o(e.VIBEPULSE_NODE_TOKEN)}(a.env??process.env);if("1"!==e.headers.get(r))return{ok:!1,status:n.unsupported_node_version,body:i("unsupported_node_version")};if(s){var l;let t,r=(l=e.headers.get("authorization"),t=l?.match(/^Bearer\s+(.+)$/i),o(t?.[1]));if(!r||r!==s)return{ok:!1,status:n.unauthorized,body:i("unauthorized")}}return{ok:!0}}e.s(["NODE_PROTOCOL_VERSION",0,"1","createNodeFailureResponse",()=>s,"createNodeRequestHeaders",()=>a,"guardNodeRequest",()=>u,"toNodeRequestGuardResponse",()=>l])},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 a(e){let t=e.deadlineMs-Date.now();return t<=0?(e.timedOut=!0,null):Math.max(1,Math.min(e.timeoutMs,t))}function i(e){return Array.from(new Set(e.filter(e=>Number.isInteger(e)&&e>0&&e<=65535))).sort((e,t)=>e-t)}function s(){let e=n(),s={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},l=i([...function(e){try{let r=a(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 a=t.match(/:(\d+)\s+\(LISTEN\)/);if(!a)continue;let i=parseInt(a[1],10);Number.isFinite(i)&&o.push(i)}return o}catch(t){return o(t)&&(e.timedOut=!0),[]}}(s),...function(e){try{let r=a(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),[]}}(s)]);for(let e of l)r.add(e);return{ports:i([...l,...Array.from(r)]),timedOut:s.timedOut}}function l(){let e=n(),r={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},i=function(e){try{let r=a(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),a=r[2];Number.isFinite(n)&&/\bopencode\b/.test(a)&&(/\b--port(?:=|\s+)\d+\b/.test(a)||o.push(n))}return Array.from(new Set(o))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(r);if(!i.length)return{processes:[],timedOut:r.timedOut};let s=[],l=new Set;for(let e of i){let n=function(e,r){try{let n=a(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 i=`${e}:${n}`;l.has(i)||(l.add(i),s.push({pid:e,cwd:n}))}return{processes:s,timedOut:r.timedOut}}e.s(["discoverOpencodePortsWithMeta",()=>s,"discoverOpencodeProcessCwdsWithoutPortWithMeta",()=>l])},58975,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),a=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),m=e.i(70101),f=e.i(26937),h=e.i(10372),v=e.i(93695);e.i(52474);var R=e.i(220);e.i(39354);var E=e.i(34959),g=e.i(99686),y=e.i(68817);let w={hostId:"local",hostLabel:"Local",hostKind:"local"};function x(e){return(e instanceof Error?e.message:String(e)).toLowerCase().includes("timed out")}function b(e){return(0,y.createNodeFailureResponse)(e,{role:"node",source:w,upstream:{kind:"opencode",reachable:!1}})}async function O(e,t,r){let n=r??new AbortController,o=(0,E.createOpencodeClient)({baseUrl:`http://localhost:${e}`}),a=null,i=new Promise((r,o)=>{a=setTimeout(()=>{n.abort(),o(Error(`OpenCode event stream preflight timed out for port ${e} after ${t}ms`))},t)});try{let t=await Promise.race([o.global.event({signal:n.signal}),i]);return{port:e,stream:t.stream,controller:n}}finally{a&&clearTimeout(a)}}async function _(e){let t=(0,y.guardNodeRequest)(e);if(!t.ok)return(0,y.toNodeRequestGuardResponse)(t);let{ports:r,timedOut:n}=(0,g.discoverOpencodePortsWithMeta)();if(!r.length)return b(n?"upstream_timeout":"upstream_unreachable");try{let t,n=new TextEncoder,o=(t=Number(process.env.OPENCODE_EVENTS_PREFLIGHT_TIMEOUT_MS),Number.isFinite(t)&&t>0?t:2500),a=new Map,i=r.map(e=>{let t=new AbortController;return a.set(e,t),O(e,o,t)}),s=await Promise.any(i).catch(async()=>{for(let e of(await Promise.allSettled(i)))"rejected"===e.status&&console.warn("Failed to connect to node-local OpenCode port during preflight:",e.reason);return null});if(!s){let e=(await Promise.allSettled(i)).filter(e=>"rejected"===e.status).map(e=>e.reason);return b(e.length>0&&e.every(x)?"upstream_timeout":"upstream_unreachable")}for(let[e,t]of a.entries())e!==s.port&&t.abort();let l=null,u=new ReadableStream({async start(t){let a=!1,i=new Set([s.controller]),u=new Set,d=e=>{try{return t.enqueue(n.encode(`data: ${JSON.stringify({role:"node",protocolVersion:y.NODE_PROTOCOL_VERSION,source:w,event:e})}
2
2
 
3
3
  `)),!0}catch{return!1}},c=()=>{try{t.close()}catch{}},p=()=>{l?l():(a=!0,c())};l=()=>{for(let e of(a=!0,i))e.abort();Promise.allSettled(Array.from(u).map(e=>e.return?.())),e.signal.removeEventListener("abort",p),c()},e.signal.addEventListener("abort",p);let m=async e=>{let t=e.stream[Symbol.asyncIterator]();u.add(t);try{for(;!a;){let e=await t.next();if(e.done||a||!d(e.value))break}}catch(t){console.warn("Node-local OpenCode event stream failed for port:",e.port,t)}finally{u.delete(t)}};try{let e=m(s),t=r.filter(e=>e!==s.port).map(async e=>{if(!a)try{let t=await O(e,o);if(i.add(t.controller),a){t.controller.abort(),i.delete(t.controller);return}await m(t),i.delete(t.controller)}catch(t){console.warn("Failed to connect to secondary node-local OpenCode port:",e,t)}});await Promise.allSettled([e,...t])}catch(e){console.error("Error in node-local event stream:",e)}finally{a=!0,l=null,e.signal.removeEventListener("abort",p),c()}},cancel(){l&&l()}});return new Response(u,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(e){return console.error("Error creating node-local event stream:",e),b(x(e)?"upstream_timeout":"upstream_unreachable")}}e.s(["GET",()=>_,"dynamic",0,"force-dynamic"],6686);var N=e.i(6686);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/node/events/route",pathname:"/api/node/events",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/node/events/route.ts",nextConfigOutput:"standalone",userland:N}),{workAsyncStorage:T,workUnitAsyncStorage:S,serverHooks:P}=C;function A(){return(0,n.patchFetch)({workAsyncStorage:T,workUnitAsyncStorage:S})}async function I(e,t,n){C.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/node/events/route";E=E.replace(/\/index$/,"")||"/";let g=await C.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,params:w,nextConfig:x,parsedUrl:b,isDraftMode:O,prerenderManifest:_,routerServerContext:N,isOnDemandRevalidate:T,revalidateOnlyGenerated:S,resolvedPathname:P,clientReferenceManifest:A,serverActionsManifest:I}=g,M=(0,s.normalizeAppPath)(E),k=!!(_.dynamicRoutes[M]||_.routes[P]),q=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,b,!1):t.end("This page could not be found"),null);if(k&&!O){let e=!!_.routes[P],t=_.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(x.experimental.adapterPath)return await q();throw new v.NoFallbackError}}let U=null;!k||C.isDev||O||(U="/index"===(U=P)?"/":U);let D=!0===C.isDev||!k,L=k&&!D;I&&A&&(0,i.setManifestsSingleton)({page:E,clientReferenceManifest:A,serverActionsManifest:I});let H=e.method||"GET",j=(0,a.getTracer)(),F=j.getActiveScopeSpan(),$={params:w,prerenderManifest:_,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:D,incrementalCache:(0,o.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:x.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,o)=>C.onRequestError(e,t,n,o,N)},sharedContext:{buildId:y}},V=new l.NodeNextRequest(e),K=new l.NodeNextResponse(t),B=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t));try{let i=async e=>C.handle(B,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=j.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} ${E}`)}),s=!!(0,o.getRequestMeta)(e,"minimalMode"),l=async o=>{var a,l;let u=async({previousCacheEntry:r})=>{try{if(!s&&T&&S&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await i(o);e.fetchMetrics=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let u=$.renderOpts.collectedTags;if(!k)return await (0,p.sendResponse)(V,K,a,$.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(a.headers);u&&(t[h.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,n=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:T})},!1,N),t}},d=await C.handleResponse({req:e,nextConfig:x,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:S,responseGenerator:u,waitUntil:n.waitUntil,isMinimalMode:s});if(!k)return null;if((null==d||null==(a=d.value)?void 0:a.kind)!==R.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});s||t.setHeader("x-nextjs-cache",T?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),O&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let v=(0,m.fromNodeOutgoingHttpHeaders)(d.value.headers);return s&&k||v.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||v.get("Cache-Control")||v.set("Cache-Control",(0,f.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(V,K,new Response(d.value.body,{headers:v,status:d.value.status||200})),null};F?await l(F):await j.withPropagatedContext(e.headers,()=>j.trace(d.BaseServerSpan.handleRequest,{spanName:`${H} ${E}`,kind:a.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},l))}catch(t){if(t instanceof v.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:T})},!1,N),k)throw t;return await (0,p.sendResponse)(V,K,new Response(null,{status:500})),null}}e.s(["handler",()=>I,"patchFetch",()=>A,"routeModule",()=>C,"serverHooks",()=>P,"workAsyncStorage",()=>T,"workUnitAsyncStorage",()=>S],58975)}];
4
4
 
5
- //# sourceMappingURL=%5Broot-of-the-server%5D__16a9eb0a._.js.map
5
+ //# sourceMappingURL=%5Broot-of-the-server%5D__e00a9200._.js.map