@a5c-ai/babysitter-observer-dashboard 5.0.1-staging.05ee168a

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 (513) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-path-routes-manifest.json +16 -0
  3. package/.next/build-manifest.json +23 -0
  4. package/.next/export-marker.json +6 -0
  5. package/.next/fallback-build-manifest.json +13 -0
  6. package/.next/images-manifest.json +68 -0
  7. package/.next/next-minimal-server.js.nft.json +1 -0
  8. package/.next/next-server.js.nft.json +1 -0
  9. package/.next/package.json +1 -0
  10. package/.next/prerender-manifest.json +114 -0
  11. package/.next/required-server-files.json +334 -0
  12. package/.next/routes-manifest.json +139 -0
  13. package/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
  14. package/.next/server/app/_global-error/page/build-manifest.json +19 -0
  15. package/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
  16. package/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
  17. package/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
  18. package/.next/server/app/_global-error/page.js +9 -0
  19. package/.next/server/app/_global-error/page.js.map +5 -0
  20. package/.next/server/app/_global-error/page.js.nft.json +1 -0
  21. package/.next/server/app/_global-error/page_client-reference-manifest.js +3 -0
  22. package/.next/server/app/_global-error.html +1 -0
  23. package/.next/server/app/_global-error.meta +15 -0
  24. package/.next/server/app/_global-error.rsc +14 -0
  25. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
  26. package/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
  27. package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
  28. package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
  29. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  30. package/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
  31. package/.next/server/app/_not-found/page/build-manifest.json +19 -0
  32. package/.next/server/app/_not-found/page/next-font-manifest.json +6 -0
  33. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
  34. package/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
  35. package/.next/server/app/_not-found/page.js +13 -0
  36. package/.next/server/app/_not-found/page.js.map +5 -0
  37. package/.next/server/app/_not-found/page.js.nft.json +1 -0
  38. package/.next/server/app/_not-found/page_client-reference-manifest.js +3 -0
  39. package/.next/server/app/_not-found.html +1 -0
  40. package/.next/server/app/_not-found.meta +16 -0
  41. package/.next/server/app/_not-found.rsc +19 -0
  42. package/.next/server/app/_not-found.segments/_full.segment.rsc +19 -0
  43. package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
  44. package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -0
  45. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +6 -0
  46. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
  47. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
  48. package/.next/server/app/api/config/route/app-paths-manifest.json +3 -0
  49. package/.next/server/app/api/config/route/build-manifest.json +9 -0
  50. package/.next/server/app/api/config/route/server-reference-manifest.json +4 -0
  51. package/.next/server/app/api/config/route.js +8 -0
  52. package/.next/server/app/api/config/route.js.map +5 -0
  53. package/.next/server/app/api/config/route.js.nft.json +1 -0
  54. package/.next/server/app/api/config/route_client-reference-manifest.js +3 -0
  55. package/.next/server/app/api/digest/route/app-paths-manifest.json +3 -0
  56. package/.next/server/app/api/digest/route/build-manifest.json +9 -0
  57. package/.next/server/app/api/digest/route/server-reference-manifest.json +4 -0
  58. package/.next/server/app/api/digest/route.js +9 -0
  59. package/.next/server/app/api/digest/route.js.map +5 -0
  60. package/.next/server/app/api/digest/route.js.nft.json +1 -0
  61. package/.next/server/app/api/digest/route_client-reference-manifest.js +3 -0
  62. package/.next/server/app/api/runs/[runId]/events/route/app-paths-manifest.json +3 -0
  63. package/.next/server/app/api/runs/[runId]/events/route/build-manifest.json +9 -0
  64. package/.next/server/app/api/runs/[runId]/events/route/server-reference-manifest.json +4 -0
  65. package/.next/server/app/api/runs/[runId]/events/route.js +8 -0
  66. package/.next/server/app/api/runs/[runId]/events/route.js.map +5 -0
  67. package/.next/server/app/api/runs/[runId]/events/route.js.nft.json +1 -0
  68. package/.next/server/app/api/runs/[runId]/events/route_client-reference-manifest.js +3 -0
  69. package/.next/server/app/api/runs/[runId]/route/app-paths-manifest.json +3 -0
  70. package/.next/server/app/api/runs/[runId]/route/build-manifest.json +9 -0
  71. package/.next/server/app/api/runs/[runId]/route/server-reference-manifest.json +4 -0
  72. package/.next/server/app/api/runs/[runId]/route.js +9 -0
  73. package/.next/server/app/api/runs/[runId]/route.js.map +5 -0
  74. package/.next/server/app/api/runs/[runId]/route.js.nft.json +1 -0
  75. package/.next/server/app/api/runs/[runId]/route_client-reference-manifest.js +3 -0
  76. package/.next/server/app/api/runs/[runId]/tasks/[effectId]/route/app-paths-manifest.json +3 -0
  77. package/.next/server/app/api/runs/[runId]/tasks/[effectId]/route/build-manifest.json +9 -0
  78. package/.next/server/app/api/runs/[runId]/tasks/[effectId]/route/server-reference-manifest.json +4 -0
  79. package/.next/server/app/api/runs/[runId]/tasks/[effectId]/route.js +8 -0
  80. package/.next/server/app/api/runs/[runId]/tasks/[effectId]/route.js.map +5 -0
  81. package/.next/server/app/api/runs/[runId]/tasks/[effectId]/route.js.nft.json +1 -0
  82. package/.next/server/app/api/runs/[runId]/tasks/[effectId]/route_client-reference-manifest.js +3 -0
  83. package/.next/server/app/api/runs/route/app-paths-manifest.json +3 -0
  84. package/.next/server/app/api/runs/route/build-manifest.json +9 -0
  85. package/.next/server/app/api/runs/route/server-reference-manifest.json +4 -0
  86. package/.next/server/app/api/runs/route.js +9 -0
  87. package/.next/server/app/api/runs/route.js.map +5 -0
  88. package/.next/server/app/api/runs/route.js.nft.json +1 -0
  89. package/.next/server/app/api/runs/route_client-reference-manifest.js +3 -0
  90. package/.next/server/app/api/stream/route/app-paths-manifest.json +3 -0
  91. package/.next/server/app/api/stream/route/build-manifest.json +9 -0
  92. package/.next/server/app/api/stream/route/server-reference-manifest.json +4 -0
  93. package/.next/server/app/api/stream/route.js +8 -0
  94. package/.next/server/app/api/stream/route.js.map +5 -0
  95. package/.next/server/app/api/stream/route.js.nft.json +1 -0
  96. package/.next/server/app/api/stream/route_client-reference-manifest.js +3 -0
  97. package/.next/server/app/api/test/route/app-paths-manifest.json +3 -0
  98. package/.next/server/app/api/test/route/build-manifest.json +9 -0
  99. package/.next/server/app/api/test/route/server-reference-manifest.json +4 -0
  100. package/.next/server/app/api/test/route.js +6 -0
  101. package/.next/server/app/api/test/route.js.map +5 -0
  102. package/.next/server/app/api/test/route.js.nft.json +1 -0
  103. package/.next/server/app/api/test/route_client-reference-manifest.js +3 -0
  104. package/.next/server/app/api/version/route/app-paths-manifest.json +3 -0
  105. package/.next/server/app/api/version/route/build-manifest.json +9 -0
  106. package/.next/server/app/api/version/route/server-reference-manifest.json +4 -0
  107. package/.next/server/app/api/version/route.js +7 -0
  108. package/.next/server/app/api/version/route.js.map +5 -0
  109. package/.next/server/app/api/version/route.js.nft.json +1 -0
  110. package/.next/server/app/api/version/route_client-reference-manifest.js +3 -0
  111. package/.next/server/app/icon.svg/route/app-paths-manifest.json +3 -0
  112. package/.next/server/app/icon.svg/route/build-manifest.json +9 -0
  113. package/.next/server/app/icon.svg/route.js +7 -0
  114. package/.next/server/app/icon.svg/route.js.map +5 -0
  115. package/.next/server/app/icon.svg/route.js.nft.json +1 -0
  116. package/.next/server/app/icon.svg.body +20 -0
  117. package/.next/server/app/icon.svg.meta +1 -0
  118. package/.next/server/app/index.html +1 -0
  119. package/.next/server/app/index.meta +14 -0
  120. package/.next/server/app/index.rsc +21 -0
  121. package/.next/server/app/index.segments/__PAGE__.segment.rsc +9 -0
  122. package/.next/server/app/index.segments/_full.segment.rsc +21 -0
  123. package/.next/server/app/index.segments/_head.segment.rsc +6 -0
  124. package/.next/server/app/index.segments/_index.segment.rsc +8 -0
  125. package/.next/server/app/index.segments/_tree.segment.rsc +2 -0
  126. package/.next/server/app/page/app-paths-manifest.json +3 -0
  127. package/.next/server/app/page/build-manifest.json +19 -0
  128. package/.next/server/app/page/next-font-manifest.json +6 -0
  129. package/.next/server/app/page/react-loadable-manifest.json +1 -0
  130. package/.next/server/app/page/server-reference-manifest.json +17 -0
  131. package/.next/server/app/page.js +15 -0
  132. package/.next/server/app/page.js.map +5 -0
  133. package/.next/server/app/page.js.nft.json +1 -0
  134. package/.next/server/app/page_client-reference-manifest.js +3 -0
  135. package/.next/server/app/runs/[runId]/page/app-paths-manifest.json +3 -0
  136. package/.next/server/app/runs/[runId]/page/build-manifest.json +19 -0
  137. package/.next/server/app/runs/[runId]/page/next-font-manifest.json +6 -0
  138. package/.next/server/app/runs/[runId]/page/react-loadable-manifest.json +22 -0
  139. package/.next/server/app/runs/[runId]/page/server-reference-manifest.json +17 -0
  140. package/.next/server/app/runs/[runId]/page.js +15 -0
  141. package/.next/server/app/runs/[runId]/page.js.map +5 -0
  142. package/.next/server/app/runs/[runId]/page.js.nft.json +1 -0
  143. package/.next/server/app/runs/[runId]/page_client-reference-manifest.js +3 -0
  144. package/.next/server/app-paths-manifest.json +16 -0
  145. package/.next/server/chunks/01oi_server_app_api_runs_[runId]_tasks_[effectId]_route_actions_0r72yai.js +3 -0
  146. package/.next/server/chunks/01oi_server_app_api_runs_[runId]_tasks_[effectId]_route_actions_0r72yai.js.map +1 -0
  147. package/.next/server/chunks/0h.v__next-internal_server_app_api_runs_[runId]_events_route_actions_0~msldk.js +3 -0
  148. package/.next/server/chunks/0h.v__next-internal_server_app_api_runs_[runId]_events_route_actions_0~msldk.js.map +1 -0
  149. package/.next/server/chunks/0h.v__next-internal_server_app_api_runs_[runId]_route_actions_09iz0n6.js +3 -0
  150. package/.next/server/chunks/0h.v__next-internal_server_app_api_runs_[runId]_route_actions_09iz0n6.js.map +1 -0
  151. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_config_route_actions_0~eypoa.js +3 -0
  152. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_config_route_actions_0~eypoa.js.map +1 -0
  153. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_digest_route_actions_04jj5zs.js +3 -0
  154. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_digest_route_actions_04jj5zs.js.map +1 -0
  155. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_runs_route_actions_0~-t-o4.js +3 -0
  156. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_runs_route_actions_0~-t-o4.js.map +1 -0
  157. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_stream_route_actions_0fkmv2_.js +3 -0
  158. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_stream_route_actions_0fkmv2_.js.map +1 -0
  159. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_test_route_actions_00ugava.js +3 -0
  160. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_test_route_actions_00ugava.js.map +1 -0
  161. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_version_route_actions_0~v3ojm.js +3 -0
  162. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_api_version_route_actions_0~v3ojm.js.map +1 -0
  163. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_icon_svg_route_actions_0yypxkm.js +3 -0
  164. package/.next/server/chunks/0juq_observer-dashboard__next-internal_server_app_icon_svg_route_actions_0yypxkm.js.map +1 -0
  165. package/.next/server/chunks/[root-of-the-server]__0.6bt.6._.js +3 -0
  166. package/.next/server/chunks/[root-of-the-server]__0.6bt.6._.js.map +1 -0
  167. package/.next/server/chunks/[root-of-the-server]__08kwev1._.js +3 -0
  168. package/.next/server/chunks/[root-of-the-server]__08kwev1._.js.map +1 -0
  169. package/.next/server/chunks/[root-of-the-server]__096el.d._.js +3 -0
  170. package/.next/server/chunks/[root-of-the-server]__096el.d._.js.map +1 -0
  171. package/.next/server/chunks/[root-of-the-server]__0_bmt4z._.js +3 -0
  172. package/.next/server/chunks/[root-of-the-server]__0_bmt4z._.js.map +1 -0
  173. package/.next/server/chunks/[root-of-the-server]__0_ln2d2._.js +3 -0
  174. package/.next/server/chunks/[root-of-the-server]__0_ln2d2._.js.map +1 -0
  175. package/.next/server/chunks/[root-of-the-server]__0al3v65._.js +3 -0
  176. package/.next/server/chunks/[root-of-the-server]__0al3v65._.js.map +1 -0
  177. package/.next/server/chunks/[root-of-the-server]__0gf516b._.js +3 -0
  178. package/.next/server/chunks/[root-of-the-server]__0gf516b._.js.map +1 -0
  179. package/.next/server/chunks/[root-of-the-server]__0kdfw4x._.js +3 -0
  180. package/.next/server/chunks/[root-of-the-server]__0kdfw4x._.js.map +1 -0
  181. package/.next/server/chunks/[root-of-the-server]__0pxt00h._.js +3 -0
  182. package/.next/server/chunks/[root-of-the-server]__0pxt00h._.js.map +1 -0
  183. package/.next/server/chunks/[root-of-the-server]__0rubnza._.js +3 -0
  184. package/.next/server/chunks/[root-of-the-server]__0rubnza._.js.map +1 -0
  185. package/.next/server/chunks/[root-of-the-server]__0tn9iud._.js +3 -0
  186. package/.next/server/chunks/[root-of-the-server]__0tn9iud._.js.map +1 -0
  187. package/.next/server/chunks/[root-of-the-server]__0ws5o6i._.js +3 -0
  188. package/.next/server/chunks/[root-of-the-server]__0ws5o6i._.js.map +1 -0
  189. package/.next/server/chunks/[turbopack]_runtime.js +903 -0
  190. package/.next/server/chunks/[turbopack]_runtime.js.map +11 -0
  191. package/.next/server/chunks/node_modules_next_04~_e52._.js +13 -0
  192. package/.next/server/chunks/node_modules_next_04~_e52._.js.map +1 -0
  193. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0nyyph-.js +9 -0
  194. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_0nyyph-.js.map +1 -0
  195. package/.next/server/chunks/packages_observer-dashboard_src_lib_02.vvb.._.js +3 -0
  196. package/.next/server/chunks/packages_observer-dashboard_src_lib_02.vvb.._.js.map +1 -0
  197. package/.next/server/chunks/packages_observer-dashboard_src_lib_0rqgpk0._.js +3 -0
  198. package/.next/server/chunks/packages_observer-dashboard_src_lib_0rqgpk0._.js.map +1 -0
  199. package/.next/server/chunks/ssr/0juq_observer-dashboard__next-internal_server_app__global-error_page_actions_0ekoxmy.js +3 -0
  200. package/.next/server/chunks/ssr/0juq_observer-dashboard__next-internal_server_app__global-error_page_actions_0ekoxmy.js.map +1 -0
  201. package/.next/server/chunks/ssr/0juq_observer-dashboard__next-internal_server_app__not-found_page_actions_09b3ti3.js +3 -0
  202. package/.next/server/chunks/ssr/0juq_observer-dashboard__next-internal_server_app__not-found_page_actions_09b3ti3.js.map +1 -0
  203. package/.next/server/chunks/ssr/[root-of-the-server]__006f7~t._.js +4 -0
  204. package/.next/server/chunks/ssr/[root-of-the-server]__006f7~t._.js.map +1 -0
  205. package/.next/server/chunks/ssr/[root-of-the-server]__02jgvbi._.js +3 -0
  206. package/.next/server/chunks/ssr/[root-of-the-server]__02jgvbi._.js.map +1 -0
  207. package/.next/server/chunks/ssr/[root-of-the-server]__04j8t~1._.js +3 -0
  208. package/.next/server/chunks/ssr/[root-of-the-server]__04j8t~1._.js.map +1 -0
  209. package/.next/server/chunks/ssr/[root-of-the-server]__09c~s.0._.js +33 -0
  210. package/.next/server/chunks/ssr/[root-of-the-server]__09c~s.0._.js.map +1 -0
  211. package/.next/server/chunks/ssr/[root-of-the-server]__0cpy61n._.js +3 -0
  212. package/.next/server/chunks/ssr/[root-of-the-server]__0cpy61n._.js.map +1 -0
  213. package/.next/server/chunks/ssr/[root-of-the-server]__0cwa32j._.js +3 -0
  214. package/.next/server/chunks/ssr/[root-of-the-server]__0cwa32j._.js.map +1 -0
  215. package/.next/server/chunks/ssr/[root-of-the-server]__0fk_g0j._.js +19 -0
  216. package/.next/server/chunks/ssr/[root-of-the-server]__0fk_g0j._.js.map +1 -0
  217. package/.next/server/chunks/ssr/[root-of-the-server]__0pddpic._.js +3 -0
  218. package/.next/server/chunks/ssr/[root-of-the-server]__0pddpic._.js.map +1 -0
  219. package/.next/server/chunks/ssr/[root-of-the-server]__0pvtneq._.js +3 -0
  220. package/.next/server/chunks/ssr/[root-of-the-server]__0pvtneq._.js.map +1 -0
  221. package/.next/server/chunks/ssr/[root-of-the-server]__0xc-2vm._.js +3 -0
  222. package/.next/server/chunks/ssr/[root-of-the-server]__0xc-2vm._.js.map +1 -0
  223. package/.next/server/chunks/ssr/[root-of-the-server]__10xgshr._.js +33 -0
  224. package/.next/server/chunks/ssr/[root-of-the-server]__10xgshr._.js.map +1 -0
  225. package/.next/server/chunks/ssr/[turbopack]_runtime.js +903 -0
  226. package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +11 -0
  227. package/.next/server/chunks/ssr/_00yo1im._.js +3 -0
  228. package/.next/server/chunks/ssr/_00yo1im._.js.map +1 -0
  229. package/.next/server/chunks/ssr/_03sbc.o._.js +3 -0
  230. package/.next/server/chunks/ssr/_03sbc.o._.js.map +1 -0
  231. package/.next/server/chunks/ssr/_04z5ea0._.js +3 -0
  232. package/.next/server/chunks/ssr/_04z5ea0._.js.map +1 -0
  233. package/.next/server/chunks/ssr/_0gmb3g_._.js +3 -0
  234. package/.next/server/chunks/ssr/_0gmb3g_._.js.map +1 -0
  235. package/.next/server/chunks/ssr/_0okz9j8._.js +6 -0
  236. package/.next/server/chunks/ssr/_0okz9j8._.js.map +1 -0
  237. package/.next/server/chunks/ssr/_0wrbwro._.js +6 -0
  238. package/.next/server/chunks/ssr/_0wrbwro._.js.map +1 -0
  239. package/.next/server/chunks/ssr/node_modules_09w7yel._.js +33 -0
  240. package/.next/server/chunks/ssr/node_modules_09w7yel._.js.map +1 -0
  241. package/.next/server/chunks/ssr/node_modules_next_dist_0avqw4q._.js +3 -0
  242. package/.next/server/chunks/ssr/node_modules_next_dist_0avqw4q._.js.map +1 -0
  243. package/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.js +6 -0
  244. package/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.js.map +1 -0
  245. package/.next/server/chunks/ssr/node_modules_next_dist_0i_._k3._.js +3 -0
  246. package/.next/server/chunks/ssr/node_modules_next_dist_0i_._k3._.js.map +1 -0
  247. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0ee1czk._.js +3 -0
  248. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0ee1czk._.js.map +1 -0
  249. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js +3 -0
  250. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js.map +1 -0
  251. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js +3 -0
  252. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js.map +1 -0
  253. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0amzg6z.js +4 -0
  254. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0amzg6z.js.map +1 -0
  255. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0dw1x0d.js +4 -0
  256. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0dw1x0d.js.map +1 -0
  257. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0rc3ul_.js +4 -0
  258. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0rc3ul_.js.map +1 -0
  259. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_10iomok.js +4 -0
  260. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_10iomok.js.map +1 -0
  261. package/.next/server/chunks/ssr/packages_observer-dashboard_0~a2tmu._.js +3 -0
  262. package/.next/server/chunks/ssr/packages_observer-dashboard_0~a2tmu._.js.map +1 -0
  263. package/.next/server/chunks/ssr/packages_observer-dashboard_src_0f.ozc-._.js +3 -0
  264. package/.next/server/chunks/ssr/packages_observer-dashboard_src_0f.ozc-._.js.map +1 -0
  265. package/.next/server/chunks/ssr/packages_observer-dashboard_src_components_providers_tsx_03_vrrn._.js +7 -0
  266. package/.next/server/chunks/ssr/packages_observer-dashboard_src_components_providers_tsx_03_vrrn._.js.map +1 -0
  267. package/.next/server/functions-config-manifest.json +4 -0
  268. package/.next/server/interception-route-rewrite-manifest.js +1 -0
  269. package/.next/server/middleware-build-manifest.js +23 -0
  270. package/.next/server/middleware-manifest.json +6 -0
  271. package/.next/server/next-font-manifest.js +1 -0
  272. package/.next/server/next-font-manifest.json +6 -0
  273. package/.next/server/pages/404.html +1 -0
  274. package/.next/server/pages/500.html +1 -0
  275. package/.next/server/pages-manifest.json +4 -0
  276. package/.next/server/prefetch-hints.json +1 -0
  277. package/.next/server/server-reference-manifest.js +1 -0
  278. package/.next/server/server-reference-manifest.json +24 -0
  279. package/.next/static/EABLIK_sdQGd8BsGP793M/_buildManifest.js +11 -0
  280. package/.next/static/EABLIK_sdQGd8BsGP793M/_clientMiddlewareManifest.js +1 -0
  281. package/.next/static/EABLIK_sdQGd8BsGP793M/_ssgManifest.js +1 -0
  282. package/.next/static/chunks/0.syqclhhnw~3.js +4 -0
  283. package/.next/static/chunks/01xlw8hd842-c.js +1 -0
  284. package/.next/static/chunks/034i63v_muq~d.js +1 -0
  285. package/.next/static/chunks/03mo-6~4pxdio.js +1 -0
  286. package/.next/static/chunks/03~yq9q893hmn.js +1 -0
  287. package/.next/static/chunks/04dm5qn77.fc2.js +1 -0
  288. package/.next/static/chunks/07uz2g0_38qia.js +4 -0
  289. package/.next/static/chunks/08nqnwvixoxnk.js +2 -0
  290. package/.next/static/chunks/09fqccrs830-n.js +1 -0
  291. package/.next/static/chunks/0d3shmwh5_nmn.js +1 -0
  292. package/.next/static/chunks/0e_wyjw3nx.a..js +1 -0
  293. package/.next/static/chunks/0jgju7iyqhzfr.js +1 -0
  294. package/.next/static/chunks/0mstyq17cbf8-.js +1 -0
  295. package/.next/static/chunks/0ntuxw9.how-q.js +1 -0
  296. package/.next/static/chunks/0t3uzajv1qzmo.js +1 -0
  297. package/.next/static/chunks/0tk7tld3z8q_b.js +1 -0
  298. package/.next/static/chunks/0u~_nwr5-v.xp.js +1 -0
  299. package/.next/static/chunks/0x6y7yt4kiddp.css +1 -0
  300. package/.next/static/chunks/0ze4gu236oq96.js +31 -0
  301. package/.next/static/chunks/0zwozael9msy1.js +1 -0
  302. package/.next/static/chunks/0~nsmwzvlcp_3.js +1 -0
  303. package/.next/static/chunks/10qd__0r7a~.l.js +1 -0
  304. package/.next/static/chunks/11jh_u1ynmatg.js +1 -0
  305. package/.next/static/chunks/144kcri75qczu.js +1 -0
  306. package/.next/static/chunks/170fc9ko4~0_4.js +5 -0
  307. package/.next/static/chunks/turbopack-0-ww6fe7b37qt.js +1 -0
  308. package/.next/static/media/icon.08ljfy7xai2x_.svg +20 -0
  309. package/LICENSE +21 -0
  310. package/README.md +490 -0
  311. package/next.config.mjs +25 -0
  312. package/package.json +104 -0
  313. package/postcss.config.mjs +8 -0
  314. package/src/app/actions/__tests__/approve-breakpoint.test.ts +246 -0
  315. package/src/app/actions/approve-breakpoint.ts +145 -0
  316. package/src/app/api/config/route.ts +137 -0
  317. package/src/app/api/digest/route.ts +45 -0
  318. package/src/app/api/runs/[runId]/events/route.ts +56 -0
  319. package/src/app/api/runs/[runId]/route.ts +84 -0
  320. package/src/app/api/runs/[runId]/tasks/[effectId]/route.ts +44 -0
  321. package/src/app/api/runs/route.ts +48 -0
  322. package/src/app/api/stream/route.ts +136 -0
  323. package/src/app/api/test/route.ts +1 -0
  324. package/src/app/api/version/route.ts +57 -0
  325. package/src/app/globals.css +555 -0
  326. package/src/app/icon.svg +20 -0
  327. package/src/app/layout.tsx +39 -0
  328. package/src/app/not-found.tsx +16 -0
  329. package/src/app/page.tsx +120 -0
  330. package/src/app/runs/[runId]/page.tsx +279 -0
  331. package/src/cli.ts +271 -0
  332. package/src/components/breakpoint/__tests__/breakpoint-approval.test.tsx +212 -0
  333. package/src/components/breakpoint/__tests__/breakpoint-panel.test.tsx +130 -0
  334. package/src/components/breakpoint/__tests__/file-preview.test.tsx +313 -0
  335. package/src/components/breakpoint/breakpoint-approval.tsx +138 -0
  336. package/src/components/breakpoint/breakpoint-panel.tsx +95 -0
  337. package/src/components/breakpoint/file-preview.tsx +215 -0
  338. package/src/components/dashboard/.gitkeep +0 -0
  339. package/src/components/dashboard/__tests__/breakpoint-banner.test.tsx +177 -0
  340. package/src/components/dashboard/__tests__/catch-up-banner.test.tsx +141 -0
  341. package/src/components/dashboard/__tests__/executive-summary-banner.test.tsx +164 -0
  342. package/src/components/dashboard/__tests__/kpi-grid.test.tsx +101 -0
  343. package/src/components/dashboard/__tests__/pagination-controls.test.tsx +125 -0
  344. package/src/components/dashboard/__tests__/project-accordion.test.tsx +97 -0
  345. package/src/components/dashboard/__tests__/project-list-view.test.tsx +174 -0
  346. package/src/components/dashboard/__tests__/project-search-input.test.tsx +110 -0
  347. package/src/components/dashboard/__tests__/project-section-header.test.tsx +91 -0
  348. package/src/components/dashboard/__tests__/project-section.test.tsx +151 -0
  349. package/src/components/dashboard/__tests__/run-card.test.tsx +164 -0
  350. package/src/components/dashboard/__tests__/run-filter-bar.test.tsx +109 -0
  351. package/src/components/dashboard/__tests__/run-list.test.tsx +123 -0
  352. package/src/components/dashboard/__tests__/search-filter.test.tsx +150 -0
  353. package/src/components/dashboard/__tests__/virtualized-run-list.test.tsx +179 -0
  354. package/src/components/dashboard/breakpoint-banner.tsx +301 -0
  355. package/src/components/dashboard/catch-up-banner.tsx +88 -0
  356. package/src/components/dashboard/executive-summary-banner.tsx +174 -0
  357. package/src/components/dashboard/global-search.tsx +323 -0
  358. package/src/components/dashboard/kpi-grid.tsx +140 -0
  359. package/src/components/dashboard/pagination-controls.tsx +100 -0
  360. package/src/components/dashboard/project-accordion.tsx +72 -0
  361. package/src/components/dashboard/project-health-card.tsx +536 -0
  362. package/src/components/dashboard/project-list-view.tsx +246 -0
  363. package/src/components/dashboard/project-search-input.tsx +41 -0
  364. package/src/components/dashboard/project-section-header.tsx +73 -0
  365. package/src/components/dashboard/project-section.tsx +89 -0
  366. package/src/components/dashboard/run-card.tsx +218 -0
  367. package/src/components/dashboard/run-filter-bar.tsx +100 -0
  368. package/src/components/dashboard/run-list.tsx +77 -0
  369. package/src/components/dashboard/search-filter.tsx +69 -0
  370. package/src/components/dashboard/virtualized-run-list.tsx +130 -0
  371. package/src/components/details/.gitkeep +0 -0
  372. package/src/components/details/__tests__/agent-panel.test.tsx +236 -0
  373. package/src/components/details/__tests__/json-tree.test.tsx +347 -0
  374. package/src/components/details/__tests__/log-viewer.test.tsx +168 -0
  375. package/src/components/details/__tests__/task-detail.test.tsx +212 -0
  376. package/src/components/details/__tests__/timing-panel.test.tsx +271 -0
  377. package/src/components/details/agent-panel.tsx +234 -0
  378. package/src/components/details/json-tree/categorize.ts +131 -0
  379. package/src/components/details/json-tree/index.tsx +120 -0
  380. package/src/components/details/json-tree/json-node.tsx +223 -0
  381. package/src/components/details/json-tree/smart-summary.tsx +596 -0
  382. package/src/components/details/json-tree/tree-controls.tsx +47 -0
  383. package/src/components/details/json-tree.tsx +9 -0
  384. package/src/components/details/log-viewer.tsx +140 -0
  385. package/src/components/details/task-detail.tsx +114 -0
  386. package/src/components/details/timing-panel.tsx +247 -0
  387. package/src/components/events/.gitkeep +0 -0
  388. package/src/components/events/__tests__/event-item.test.tsx +211 -0
  389. package/src/components/events/__tests__/event-stream.test.tsx +225 -0
  390. package/src/components/events/event-item.tsx +121 -0
  391. package/src/components/events/event-stream.tsx +260 -0
  392. package/src/components/notifications/.gitkeep +0 -0
  393. package/src/components/notifications/__tests__/notification-panel.test.tsx +287 -0
  394. package/src/components/notifications/__tests__/notification-provider.test.tsx +585 -0
  395. package/src/components/notifications/__tests__/toast-stack.test.tsx +217 -0
  396. package/src/components/notifications/notification-panel.tsx +124 -0
  397. package/src/components/notifications/notification-provider.tsx +175 -0
  398. package/src/components/notifications/toast-stack.tsx +75 -0
  399. package/src/components/pipeline/.gitkeep +0 -0
  400. package/src/components/pipeline/__tests__/parallel-group.test.tsx +88 -0
  401. package/src/components/pipeline/__tests__/pipeline-view.test.tsx +345 -0
  402. package/src/components/pipeline/__tests__/step-card.test.tsx +330 -0
  403. package/src/components/pipeline/parallel-group.tsx +39 -0
  404. package/src/components/pipeline/pipeline-view.tsx +197 -0
  405. package/src/components/pipeline/step-card.tsx +166 -0
  406. package/src/components/providers/event-stream-provider.tsx +29 -0
  407. package/src/components/providers.tsx +24 -0
  408. package/src/components/shared/.gitkeep +0 -0
  409. package/src/components/shared/__tests__/empty-state.test.tsx +49 -0
  410. package/src/components/shared/__tests__/friendly-id.test.tsx +47 -0
  411. package/src/components/shared/__tests__/kbd.test.tsx +45 -0
  412. package/src/components/shared/__tests__/kind-badge.test.tsx +71 -0
  413. package/src/components/shared/__tests__/metrics-row.test.tsx +74 -0
  414. package/src/components/shared/__tests__/outcome-banner.test.tsx +71 -0
  415. package/src/components/shared/__tests__/progress-bar.test.tsx +89 -0
  416. package/src/components/shared/__tests__/session-pill.test.tsx +62 -0
  417. package/src/components/shared/__tests__/settings-modal.test.tsx +201 -0
  418. package/src/components/shared/__tests__/shortcuts-help.test.tsx +103 -0
  419. package/src/components/shared/__tests__/status-badge.test.tsx +98 -0
  420. package/src/components/shared/__tests__/theme-provider.test.tsx +100 -0
  421. package/src/components/shared/__tests__/truncated-id.test.tsx +53 -0
  422. package/src/components/shared/app-footer.tsx +80 -0
  423. package/src/components/shared/app-header.tsx +160 -0
  424. package/src/components/shared/empty-state.tsx +18 -0
  425. package/src/components/shared/error-boundary.tsx +81 -0
  426. package/src/components/shared/friendly-id.tsx +48 -0
  427. package/src/components/shared/kbd.tsx +15 -0
  428. package/src/components/shared/kind-badge.tsx +51 -0
  429. package/src/components/shared/metrics-row.tsx +106 -0
  430. package/src/components/shared/outcome-banner.tsx +56 -0
  431. package/src/components/shared/progress-bar.tsx +42 -0
  432. package/src/components/shared/session-pill.tsx +69 -0
  433. package/src/components/shared/settings-modal.tsx +509 -0
  434. package/src/components/shared/shortcuts-help.tsx +113 -0
  435. package/src/components/shared/status-badge.tsx +110 -0
  436. package/src/components/shared/theme-provider.tsx +46 -0
  437. package/src/components/shared/truncated-id.tsx +51 -0
  438. package/src/components/ui/.gitkeep +0 -0
  439. package/src/components/ui/__tests__/accordion.test.tsx +96 -0
  440. package/src/components/ui/__tests__/badge.test.tsx +69 -0
  441. package/src/components/ui/__tests__/button.test.tsx +113 -0
  442. package/src/components/ui/__tests__/tabs.test.tsx +75 -0
  443. package/src/components/ui/__tests__/tooltip.test.tsx +90 -0
  444. package/src/components/ui/accordion.tsx +61 -0
  445. package/src/components/ui/badge.tsx +25 -0
  446. package/src/components/ui/button.tsx +40 -0
  447. package/src/components/ui/card.tsx +21 -0
  448. package/src/components/ui/scroll-area.tsx +35 -0
  449. package/src/components/ui/separator.tsx +24 -0
  450. package/src/components/ui/tabs.tsx +64 -0
  451. package/src/components/ui/tooltip.tsx +37 -0
  452. package/src/hooks/.gitkeep +0 -0
  453. package/src/hooks/__tests__/use-animated-number.test.ts +184 -0
  454. package/src/hooks/__tests__/use-batched-updates.test.ts +315 -0
  455. package/src/hooks/__tests__/use-event-stream.test.ts +243 -0
  456. package/src/hooks/__tests__/use-keyboard.test.ts +217 -0
  457. package/src/hooks/__tests__/use-notifications.test.ts +230 -0
  458. package/src/hooks/__tests__/use-polling.test.ts +274 -0
  459. package/src/hooks/__tests__/use-project-runs.test.ts +163 -0
  460. package/src/hooks/__tests__/use-projects.test.ts +248 -0
  461. package/src/hooks/__tests__/use-run-dashboard.test.ts +168 -0
  462. package/src/hooks/__tests__/use-run-detail.test.ts +273 -0
  463. package/src/hooks/__tests__/use-smart-polling.test.ts +305 -0
  464. package/src/hooks/use-animated-number.ts +87 -0
  465. package/src/hooks/use-batched-updates.ts +150 -0
  466. package/src/hooks/use-event-stream.ts +150 -0
  467. package/src/hooks/use-keyboard.ts +45 -0
  468. package/src/hooks/use-notifications.ts +82 -0
  469. package/src/hooks/use-persisted-state.ts +60 -0
  470. package/src/hooks/use-polling.ts +60 -0
  471. package/src/hooks/use-project-runs.ts +51 -0
  472. package/src/hooks/use-projects.ts +26 -0
  473. package/src/hooks/use-run-dashboard.ts +207 -0
  474. package/src/hooks/use-run-detail.ts +77 -0
  475. package/src/hooks/use-smart-polling.ts +144 -0
  476. package/src/lib/.gitkeep +0 -0
  477. package/src/lib/__tests__/cn.test.ts +69 -0
  478. package/src/lib/__tests__/config-loader.test.ts +210 -0
  479. package/src/lib/__tests__/config.test.ts +561 -0
  480. package/src/lib/__tests__/error-handler.test.ts +143 -0
  481. package/src/lib/__tests__/fetcher.test.ts +517 -0
  482. package/src/lib/__tests__/global-registry.test.ts +214 -0
  483. package/src/lib/__tests__/parser.test.ts +1532 -0
  484. package/src/lib/__tests__/path-resolver.test.ts +112 -0
  485. package/src/lib/__tests__/run-cache.test.ts +591 -0
  486. package/src/lib/__tests__/server-init.test.ts +512 -0
  487. package/src/lib/__tests__/source-discovery.test.ts +246 -0
  488. package/src/lib/__tests__/utils.test.ts +160 -0
  489. package/src/lib/__tests__/watcher.test.ts +227 -0
  490. package/src/lib/cn.ts +6 -0
  491. package/src/lib/config-loader.ts +195 -0
  492. package/src/lib/config.ts +20 -0
  493. package/src/lib/error-handler.ts +76 -0
  494. package/src/lib/fetcher.ts +394 -0
  495. package/src/lib/global-registry.ts +117 -0
  496. package/src/lib/parser.ts +794 -0
  497. package/src/lib/path-resolver.ts +16 -0
  498. package/src/lib/run-cache.ts +404 -0
  499. package/src/lib/server-init.ts +226 -0
  500. package/src/lib/services/__tests__/run-query-service.test.ts +819 -0
  501. package/src/lib/services/run-query-service.ts +286 -0
  502. package/src/lib/source-discovery.ts +216 -0
  503. package/src/lib/utils.ts +103 -0
  504. package/src/lib/watcher.ts +265 -0
  505. package/src/test/fixtures.ts +269 -0
  506. package/src/test/mocks/handlers.ts +110 -0
  507. package/src/test/mocks/server.ts +17 -0
  508. package/src/test/setup.ts +200 -0
  509. package/src/test/test-utils.tsx +36 -0
  510. package/src/types/.gitkeep +0 -0
  511. package/src/types/breakpoint.ts +17 -0
  512. package/src/types/index.ts +214 -0
  513. package/tsconfig.json +50 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/observer-dashboard/src/lib/error-handler.ts","../../../../../packages/observer-dashboard/src/lib/path-resolver.ts","../../../../../packages/observer-dashboard/src/app/api/runs/%5BrunId%5D/route.ts","../../../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["/**\r\n * Centralized error handling utilities.\r\n *\r\n * - `AppError` – typed error with HTTP status and machine-readable code.\r\n * - `normalizeError` – converts any thrown value (Error, string, object,\r\n * undefined, etc.) into a consistent `{ message, code, status }` shape\r\n * safe for API responses (never leaks stack traces).\r\n */\r\n\r\nexport class AppError extends Error {\r\n readonly code: string;\r\n readonly status: number;\r\n\r\n constructor(message: string, code: string, status: number) {\r\n super(message);\r\n this.name = \"AppError\";\r\n this.code = code;\r\n this.status = status;\r\n\r\n // Fix prototype chain for instanceof checks (TS class extending Error)\r\n Object.setPrototypeOf(this, AppError.prototype);\r\n }\r\n}\r\n\r\nexport interface NormalizedError {\r\n message: string;\r\n code: string;\r\n status: number;\r\n}\r\n\r\n/**\r\n * Convert any thrown value into a consistent error shape.\r\n *\r\n * - `AppError` → preserves code & status.\r\n * - Standard `Error` → maps common system errors (ENOENT, EACCES, ENOTDIR)\r\n * to appropriate HTTP status codes; defaults to 500.\r\n * - `string` → wraps as 500 internal error.\r\n * - Anything else (null, undefined, number, object) → generic 500.\r\n */\r\nexport function normalizeError(err: unknown): NormalizedError {\r\n // Already a well-typed AppError\r\n if (err instanceof AppError) {\r\n return { message: err.message, code: err.code, status: err.status };\r\n }\r\n\r\n // Standard Error (or subclass)\r\n if (err instanceof Error) {\r\n const nodeErr = err as NodeJS.ErrnoException;\r\n\r\n // Map common Node.js filesystem error codes\r\n if (nodeErr.code === \"ENOENT\") {\r\n return { message: \"Resource not found\", code: \"NOT_FOUND\", status: 404 };\r\n }\r\n if (nodeErr.code === \"EACCES\" || nodeErr.code === \"EPERM\") {\r\n return { message: \"Permission denied\", code: \"PERMISSION_DENIED\", status: 403 };\r\n }\r\n if (nodeErr.code === \"ENOTDIR\" || nodeErr.code === \"EISDIR\") {\r\n return { message: \"Invalid resource path\", code: \"INVALID_PATH\", status: 400 };\r\n }\r\n\r\n // SyntaxError from JSON.parse\r\n if (err instanceof SyntaxError) {\r\n return { message: \"Failed to parse data\", code: \"PARSE_ERROR\", status: 400 };\r\n }\r\n\r\n return { message: err.message || \"Internal server error\", code: \"INTERNAL_ERROR\", status: 500 };\r\n }\r\n\r\n // Plain string throw\r\n if (typeof err === \"string\") {\r\n return { message: err, code: \"INTERNAL_ERROR\", status: 500 };\r\n }\r\n\r\n // Anything else (null, undefined, number, object without Error prototype)\r\n return { message: \"An unexpected error occurred\", code: \"UNKNOWN_ERROR\", status: 500 };\r\n}\r\n","import path from \"path\";\nimport { discoverAllRunDirs, invalidateDiscoveryCache, type DiscoveredRun } from \"./source-discovery\";\n\n// Find a specific run directory by runId across all sources.\n// On cache miss, invalidates the discovery cache and retries once\n// to handle runs created after the last cache refresh.\nexport async function findRunDir(runId: string): Promise<DiscoveredRun | null> {\n const allRuns = await discoverAllRunDirs();\n const found = allRuns.find((r) => path.basename(r.runDir) === runId);\n if (found) return found;\n\n // Cache may be stale — force re-discovery and retry\n invalidateDiscoveryCache();\n const fresh = await discoverAllRunDirs();\n return fresh.find((r) => path.basename(r.runDir) === runId) || null;\n}\n","import { NextResponse } from \"next/server\";\r\nimport { findRunDir } from \"@/lib/path-resolver\";\r\nimport { ensureInitialized } from \"@/lib/server-init\";\r\nimport { getRunCached } from \"@/lib/run-cache\";\r\nimport { normalizeError } from \"@/lib/error-handler\";\r\nimport { createHash } from \"crypto\";\r\n\r\nexport const dynamic = \"force-dynamic\";\r\n\r\nfunction isValidId(id: string): boolean {\r\n return /^[a-zA-Z0-9_\\-]+$/.test(id);\r\n}\r\n\r\nconst DEFAULT_MAX_EVENTS = 50;\r\n\r\n/**\r\n * Generate a lightweight ETag from run state.\r\n * Uses status, task count, event count, and updatedAt as a fingerprint\r\n * to avoid re-serializing unchanged data to the client.\r\n */\r\nfunction generateETag(run: { status: string; updatedAt: string; tasks: unknown[]; events: unknown[] }): string {\r\n const fingerprint = `${run.status}:${run.tasks.length}:${run.events.length}:${run.updatedAt}`;\r\n const hash = createHash(\"md5\").update(fingerprint).digest(\"hex\").slice(0, 16);\r\n return `\"${hash}\"`;\r\n}\r\n\r\nexport async function GET(\r\n request: Request,\r\n { params }: { params: { runId: string } }\r\n) {\r\n try {\r\n // Ensure watcher and cache are initialized\r\n await ensureInitialized();\r\n\r\n const { runId } = params;\r\n if (!isValidId(runId)) {\r\n return NextResponse.json({ error: \"Invalid run ID\" }, { status: 400 });\r\n }\r\n\r\n const found = await findRunDir(runId);\r\n if (!found) {\r\n return NextResponse.json({ error: \"Run not found\" }, { status: 404 });\r\n }\r\n\r\n // Use cached run for better performance\r\n const run = await getRunCached(found.runDir, found.source, found.projectName);\r\n\r\n // Limit events returned (keep most recent) to reduce payload size\r\n const { searchParams } = new URL(request.url);\r\n const maxEvents = parseInt(searchParams.get(\"maxEvents\") || String(DEFAULT_MAX_EVENTS));\r\n const totalEvents = run.events.length;\r\n const limitedRun = totalEvents > maxEvents\r\n ? { ...run, events: run.events.slice(-maxEvents), totalEvents }\r\n : { ...run, totalEvents };\r\n\r\n // ETag support: if client sends If-None-Match and data hasn't changed,\r\n // return 304 Not Modified to save bandwidth and serialization cost.\r\n const etag = generateETag(limitedRun);\r\n const ifNoneMatch = request.headers.get(\"If-None-Match\");\r\n if (ifNoneMatch && ifNoneMatch === etag) {\r\n return new NextResponse(null, {\r\n status: 304,\r\n headers: {\r\n ETag: etag,\r\n \"Cache-Control\": \"no-cache\",\r\n },\r\n });\r\n }\r\n\r\n return NextResponse.json({ run: limitedRun }, {\r\n headers: {\r\n \"Cache-Control\": \"no-cache\",\r\n ETag: etag,\r\n },\r\n });\r\n } catch (error) {\r\n console.error(\"Failed to read run:\", error);\r\n const normalized = normalizeError(error);\r\n return NextResponse.json(\r\n { error: normalized.message, code: normalized.code },\r\n { status: normalized.status }\r\n );\r\n }\r\n}\r\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/runs/[runId]/route\",\n pathname: \"/api/runs/[runId]\",\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]/packages/observer-dashboard/src/app/api/runs/[runId]/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/runs/[runId]/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["AppError","Error","code","status","message","name","Object","setPrototypeOf","prototype","normalizeError","err","nodeErr","SyntaxError","findRunDir","runId","allRuns","found","find","r","basename","runDir","fresh","dynamic","isValidId","id","test","DEFAULT_MAX_EVENTS","generateETag","run","fingerprint","tasks","length","events","updatedAt","hash","update","digest","slice","url","GET","request","params","json","error","ETag","source","projectName","searchParams","URL","maxEvents","parseInt","get","String","totalEvents","limitedRun","etag","ifNoneMatch","headers","console","normalized"],"mappings":"6lCASO,OAAMA,UAAiBC,MACnBC,IAAa,CACbC,MAETH,AAFwB,aAEZI,CAAe,CAAEF,CAAY,CAAEC,CAAc,CAAE,CACzD,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E5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[3]}
@@ -0,0 +1,3 @@
1
+ module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},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"))},64879,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),R=e.i(26937),v=e.i(10372),x=e.i(93695);e.i(52474);var g=e.i(220);async function w(){return new Response("test",{status:200})}e.s(["GET",0,w],85901);var f=e.i(85901);let E=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/test/route",pathname:"/api/test",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/packages/observer-dashboard/src/app/api/test/route.ts",nextConfigOutput:"",userland:f,...{}}),{workAsyncStorage:m,workUnitAsyncStorage:C,serverHooks:y}=E;async function b(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/test/route";w=w.replace(/\/index$/,"")||"/";let f=await E.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:m,params:C,nextConfig:y,parsedUrl:b,isDraftMode:A,prerenderManifest:T,routerServerContext:N,isOnDemandRevalidate:P,revalidateOnlyGenerated:q,resolvedPathname:S,clientReferenceManifest:_,serverActionsManifest:O}=f,k=(0,i.normalizeAppPath)(w),H=!!(T.dynamicRoutes[k]||T.routes[S]),I=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,b,!1):t.end("This page could not be found"),null);if(H&&!A){let e=!!T.routes[S],t=T.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(y.adapterPath)return await I();throw new x.NoFallbackError}}let U=null;!H||E.isDev||A||(U="/index"===(U=S)?"/":U);let j=!0===E.isDev||!H,M=H&&!j;O&&_&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:_,serverActionsManifest:O});let D=e.method||"GET",$=(0,s.getTracer)(),F=$.getActiveScopeSpan(),K=!!(null==N?void 0:N.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),L=(0,n.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,y,T,B);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let G={params:C,previewProps:T.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts},cacheComponents:!!y.cacheComponents,supportsDynamicResponse:j,incrementalCache:L,cacheLifeProfiles:y.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>E.onRequestError(e,t,a,n,N)},sharedContext:{buildId:m}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t));try{let n,o=async e=>E.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${D} ${w}`)}),i=async n=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!B&&P&&q&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let i=G.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=G.renderOpts.collectedTags;if(!H)return await (0,c.sendResponse)(V,W,s,G.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[v.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,a=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:P})},!1,N),t}},d=await E.handleResponse({req:e,nextConfig:y,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:P,revalidateOnlyGenerated:q,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:B});if(!H)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",P?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&H||u.delete(v.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,R.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(V,W,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&F?await i(F):(n=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${D} ${w}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},i),void 0,!K))}catch(t){if(t instanceof x.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:P})},!1,N),H)throw t;return await (0,c.sendResponse)(V,W,new Response(null,{status:500})),null}}e.s(["handler",0,b,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:m,workUnitAsyncStorage:C})},"routeModule",0,E,"serverHooks",0,y,"workAsyncStorage",0,m,"workUnitAsyncStorage",0,C],64879)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0gf516b._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../../../packages/observer-dashboard/src/app/api/test/route.ts"],"sourcesContent":["import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/test/route\",\n pathname: \"/api/test\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/packages/observer-dashboard/src/app/api/test/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/test/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","export async function GET() { return new Response(\"test\", { status: 200 }); }\n"],"names":["GET","Response","status"],"mappings":"msBAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAA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AE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,EACA,sBACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[0]}
@@ -0,0 +1,3 @@
1
+ module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},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"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},76824,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),v=e.i(26937),x=e.i(10372),R=e.i(93695);e.i(52474);var g=e.i(220),f=e.i(89171),w=e.i(33405),m=e.i(22734),y=e.i(14747);let E=null,b=0,C=0;async function A(){let e,t,r;return(!E||(t=(e=Date.now())-C,r=e-b,C>0&&t>6e4||r>3e5))&&(E={app:function(){try{let e=(0,y.resolve)("/ROOT/packages/observer-dashboard/src/app/api/version","..","..","..","..","package.json");return JSON.parse((0,m.readFileSync)(e,"utf-8")).version||"5.0.1-staging.05ee168a"}catch{return"5.0.1-staging.05ee168a"}}(),babysitter:function(e){try{let t=(0,w.execSync)(e,{encoding:"utf-8",timeout:3e3}).trim(),r=t.match(/(\d+\.\d+\.\d+)/);return r?r[1]:t||"N/A"}catch{return"N/A"}}("babysitter --version")},b=Date.now()),C=Date.now(),f.NextResponse.json(E)}e.s(["GET",0,A,"dynamic",0,"force-dynamic"],82156);var N=e.i(82156);let T=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/version/route",pathname:"/api/version",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/packages/observer-dashboard/src/app/api/version/route.ts",nextConfigOutput:"",userland:N,...{}}),{workAsyncStorage:q,workUnitAsyncStorage:S,serverHooks:k}=T;async function O(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),T.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let f="/api/version/route";f=f.replace(/\/index$/,"")||"/";let w=await T.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:m,params:y,nextConfig:E,parsedUrl:b,isDraftMode:C,prerenderManifest:A,routerServerContext:N,isOnDemandRevalidate:q,revalidateOnlyGenerated:S,resolvedPathname:k,clientReferenceManifest:O,serverActionsManifest:P}=w,_=(0,o.normalizeAppPath)(f),j=!!(A.dynamicRoutes[_]||A.routes[k]),H=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,b,!1):t.end("This page could not be found"),null);if(j&&!C){let e=!!A.routes[k],t=A.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await H();throw new R.NoFallbackError}}let D=null;!j||T.isDev||C||(D="/index"===(D=k)?"/":D);let I=!0===T.isDev||!j,U=j&&!I;P&&O&&(0,i.setManifestsSingleton)({page:f,clientReferenceManifest:O,serverActionsManifest:P});let M=e.method||"GET",F=(0,s.getTracer)(),$=F.getActiveScopeSpan(),K=!!(null==N?void 0:N.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),L=(0,n.getRequestMeta)(e,"incrementalCache")||await T.getIncrementalCache(e,E,A,B);null==L||L.resetRequestCache(),globalThis.__incrementalCache=L;let G={params:y,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:I,incrementalCache:L,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>T.onRequestError(e,t,a,n,N)},sharedContext:{buildId:m}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t));try{let n,i=async e=>T.handle(X,G).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${M} ${f}`)}),o=async n=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!B&&q&&S&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=G.renderOpts.fetchMetrics;let o=G.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=G.renderOpts.collectedTags;if(!j)return await (0,c.sendResponse)(V,W,s,G.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[x.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,a=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:G.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await T.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:q})},!1,N),t}},d=await T.handleResponse({req:e,nextConfig:E,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:q,revalidateOnlyGenerated:S,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:B});if(!j)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",q?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,h.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&j||u.delete(x.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,v.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(V,W,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};K&&$?await o($):(n=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${f}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},o),void 0,!K))}catch(t){if(t instanceof R.NoFallbackError||await T.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:q})},!1,N),j)throw t;return await (0,c.sendResponse)(V,W,new Response(null,{status:500})),null}}e.s(["handler",0,O,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:q,workUnitAsyncStorage:S})},"routeModule",0,T,"serverHooks",0,k,"workAsyncStorage",0,q,"workUnitAsyncStorage",0,S],76824)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0kdfw4x._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/observer-dashboard/src/app/api/version/route.ts","../../../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextResponse } from \"next/server\";\r\nimport { execSync } from \"child_process\";\r\nimport { readFileSync } from \"fs\";\r\nimport { resolve } from \"path\";\r\n\r\nexport const dynamic = \"force-dynamic\";\r\n\r\nfunction detectVersion(command: string): string {\r\n try {\r\n const raw = execSync(command, { encoding: \"utf-8\", timeout: 3000 }).trim();\r\n const match = raw.match(/(\\d+\\.\\d+\\.\\d+)/);\r\n return match ? match[1] : raw || \"N/A\";\r\n } catch {\r\n return \"N/A\";\r\n }\r\n}\r\n\r\nfunction getAppVersion(): string {\r\n try {\r\n const pkgPath = resolve(__dirname, \"..\", \"..\", \"..\", \"..\", \"package.json\");\r\n const pkg = JSON.parse(readFileSync(pkgPath, \"utf-8\"));\r\n return pkg.version || process.env.NEXT_PUBLIC_APP_VERSION || \"unknown\";\r\n } catch {\r\n return process.env.NEXT_PUBLIC_APP_VERSION || \"unknown\";\r\n }\r\n}\r\n\r\nconst CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes for normal polling\r\nconst IDLE_THRESHOLD_MS = 60 * 1000; // 1 minute gap = user was away\r\n\r\nlet cached: { app: string; babysitter: string } | null = null;\r\nlet cachedAt = 0;\r\nlet lastRequestAt = 0;\r\n\r\nfunction isCacheStale(): boolean {\r\n const now = Date.now();\r\n const idleGap = now - lastRequestAt;\r\n const cacheAge = now - cachedAt;\r\n\r\n // User returned after being away — likely upgraded something\r\n if (lastRequestAt > 0 && idleGap > IDLE_THRESHOLD_MS) return true;\r\n\r\n // Normal TTL expiry\r\n return cacheAge > CACHE_TTL_MS;\r\n}\r\n\r\nexport async function GET() {\r\n if (!cached || isCacheStale()) {\r\n cached = {\r\n app: getAppVersion(),\r\n babysitter: detectVersion(\"babysitter --version\"),\r\n };\r\n cachedAt = Date.now();\r\n }\r\n lastRequestAt = Date.now();\r\n return NextResponse.json(cached);\r\n}\r\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/version/route\",\n pathname: \"/api/version\",\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]/packages/observer-dashboard/src/app/api/version/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/version/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["dynamic","detectVersion","command","raw","encoding","timeout","trim","match","getAppVersion","pkgPath","pkg","JSON","parse","now","version","CACHE_TTL_MS","IDLE_THRESHOLD_MS","cached","cachedAt","lastRequestAt","isCacheStale","Date","idleGap","cacheAge","GET","app","babysitter","json"],"mappings":"qjCCAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OA2BA,IAAIiB,EAAqD,KACrDC,EAAW,EACXC,EAAgB,EAcb,eAAeK,IAXpB,IAAMX,MAoBN,MARI,EAACI,IAXCK,EAAUT,GADJQ,CAYGD,IAZEP,GAAG,IACEM,EAChBI,EAAWV,EAAMK,EAGvB,AAAIC,EAAgB,GAAKG,EAZD,KAejBC,AAfsB,EADV,CAagBP,GAOpBI,AAnBoB,A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E,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,CAGI,IAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GACvB,AAD0B,CAE9B,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,EATmB,CAShB,EAAY,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA3TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAW,AAAX,EAAY,kBACf,uBACA,CACJ,EACJ","ignoreList":[1]}
@@ -0,0 +1,3 @@
1
+ module.exports=[36111,19903,e=>{"use strict";var t=e.i(40564),r=e.i(75619),n=e.i(22734),i=e.i(14747);function a(e,t){globalThis.__observer_registry__||(globalThis.__observer_registry__={});let r=globalThis.__observer_registry__;return void 0===r[e]&&(r[e]=t()),r[e]}function s(){return a("__observer_run_cache__",()=>new Map)}function o(e){return"waiting"===e||"pending"===e?5e3:3e4}function l(e){let t=Date.now(),r=o(e.digest.status);return t-e.cachedAt<r}function c(){let e=s();if(e.size<=1e3)return;let t=Date.now();for(let[r,n]of e)t-n.cachedAt>=o(n.digest.status)&&e.delete(r);if(e.size<=1e3)return;let r=Array.from(e.entries()).sort(([,e],[,t])=>e.cachedAt-t.cachedAt),n=e.size-1e3;for(let t=0;t<n;t++)e.delete(r[t][0])}async function u(e){try{let t=i.default.join(e,"run.json"),r=await n.promises.readFile(t,"utf-8"),a=JSON.parse(r);return{processId:a.processId||"unknown",projectName:a.projectName||void 0}}catch(t){return!function(e){if(!(e instanceof Error))return!1;let t=e.code;return"ENOENT"===t||"ENOTDIR"===t||e.message.includes("ENOENT")}(t)&&console.warn(`[run-cache] Failed to read run.json metadata from ${e}:`,t),{processId:"unknown"}}}async function d(e,r,n){let i=s(),a=i.get(e);if(a&&l(a))return a.digest;let o=await (0,t.getRunDigest)(e),d=await u(e),f=d.projectName||n,g={...o,processId:d.processId,sourceLabel:r.label,projectName:f};return i.set(e,{digest:g,cachedAt:Date.now(),runDir:e,fullRun:a?.fullRun,journalFileCount:a?.journalFileCount}),c(),g}async function f(e,r,n){let i=s(),a=i.get(e);if(a&&l(a)&&a.fullRun)return a.fullRun;let o=a?.fullRun&&void 0!==a.journalFileCount?{previousEvents:a.fullRun.events,previousFileCount:a.journalFileCount}:void 0,f=await (0,t.parseRunDir)(e,o),g=f._journalFileCount,p=(await u(e)).projectName||n,m={...f,sourceLabel:r.label,projectName:p};delete m._journalFileCount;let h=await d(e,r,n);return i.set(e,{digest:h,cachedAt:Date.now(),runDir:e,fullRun:m,journalFileCount:g}),c(),m}e.s(["getGlobal",0,a],19903);let g=0,p=!0;async function m(){let e=s(),t=Date.now();if(e.size>0&&!p&&t-g<1e4)return;g=t,p=!1;let n=await (0,r.discoverAllRunDirs)(),a=new Set,o=n.filter(e=>{let t=i.default.basename(e.runDir);return!a.has(t)&&(a.add(t),!0)}),l=new Set(o.map(e=>e.runDir));for(let[t]of e)l.has(t)||e.delete(t);for(let e=0;e<o.length;e+=10){let t=o.slice(e,e+10);await Promise.all(t.map(async e=>{try{await d(e.runDir,e.source,e.projectName)}catch(t){console.error(`Failed to cache run ${e.runDir}:`,t)}}))}}e.s(["discoverAndCacheAll",0,m,"getAllCachedDigests",0,function(){let e=s(),t=[];for(let r of e.values())t.push(r.digest);return t},"getProjectSummaries",0,function(){let e=s(),t=new Map;for(let r of e.values()){let e=r.digest.projectName||"Unknown",n=t.get(e)||{totalRuns:0,activeRuns:0,completedRuns:0,failedRuns:0,staleRuns:0,totalTasks:0,completedTasksAggregate:0,latestUpdate:"",pendingBreakpoints:0,breakpointRuns:[]};n.totalRuns++,n.totalTasks+=r.digest.taskCount||0,n.completedTasksAggregate+=r.digest.completedTasks||0,"waiting"!==r.digest.status&&"pending"!==r.digest.status||r.digest.isStale?"completed"===r.digest.status?n.completedRuns++:"failed"===r.digest.status&&n.failedRuns++:n.activeRuns++,r.digest.isStale&&n.staleRuns++,r.digest.pendingBreakpoints&&r.digest.pendingBreakpoints>0&&"breakpoint"===r.digest.waitingKind&&(n.pendingBreakpoints+=r.digest.pendingBreakpoints,n.breakpointRuns.push({runId:r.digest.runId,effectId:r.digest.breakpointEffectId||"",projectName:e,processId:r.digest.processId||"unknown",breakpointQuestion:r.digest.breakpointQuestion||"Approval required"})),(!n.latestUpdate||r.digest.updatedAt>n.latestUpdate)&&(n.latestUpdate=r.digest.updatedAt),t.set(e,n)}return Array.from(t.entries()).map(([e,t])=>({projectName:e,...t}))},"getRunCached",0,f,"invalidateAll",0,function(){s().clear(),g=0,p=!0},"invalidateRun",0,function(e){s().delete(e)},"requestDiscovery",0,function(){p=!0}],36111)},27699,(e,t,r)=>{t.exports=e.x("events",()=>require("events"))},63372,e=>{"use strict";var t=e.i(14747),r=e.i(27699),n=e.i(22734),i=e.i(75619),a=e.i(36111),s=e.i(19903);let o=(0,s.getGlobal)("__observer_watcher_events__",()=>new r.EventEmitter);function l(){return(0,s.getGlobal)("__observer_watchers__",()=>({activeWatchers:new Map,debounceTimers:new Map,rescanTimer:null}))}function c(e,t){let r=l(),n=r.debounceTimers.get(e);n&&clearTimeout(n);let i=setTimeout(()=>{r.debounceTimers.delete(e),t()},500);r.debounceTimers.set(e,i)}function u(e){let r=t.default.dirname(e);c(r,()=>{(0,a.invalidateRun)(r),(0,a.requestDiscovery)(),o.emit("change",{type:"run-changed",runDir:r})})}function d(e){let r=t.default.dirname(e);c(r,()=>{(0,a.invalidateRun)(r),(0,a.requestDiscovery)(),o.emit("change",{type:"run-changed",runDir:r})})}function f(e){c(e,()=>{(0,i.invalidateDiscoveryCache)(),(0,a.requestDiscovery)(),o.emit("change",{type:"new-run",runDir:e})})}async function g(){let e=l(),r=await (0,i.discoverAllRunDirs)(),a=new Set,s=new Set;for(let{runDir:e}of r){let r=t.default.join(e,"journal");try{await n.promises.access(r),s.add(r)}catch{}let i=t.default.join(e,"tasks");try{await n.promises.access(i),s.add(i)}catch{}let o=t.default.dirname(e);a.add(o)}try{for(let e of(await (0,i.discoverAllRunsParentDirs)()))a.add(e)}catch{}for(let e of a)try{await n.promises.access(e),s.add(e)}catch{}for(let[t,r]of e.activeWatchers.entries())s.has(t)||(r.close(),e.activeWatchers.delete(t));for(let r of s)if(!e.activeWatchers.has(r)){let i=t.default.basename(r),a="journal"===i,s="tasks"===i,l=function(e,t){try{let r=(0,n.watch)(e,{recursive:!1},(r,n)=>{n&&t(e)});return r.on("error",t=>{console.error(`Watch error for ${e}:`,t),o.emit("change",{type:"error",runDir:e,error:t})}),r}catch(t){return console.error(`Failed to watch ${e}:`,t),null}}(r,a?u:s?d:f);l&&e.activeWatchers.set(r,l)}console.log(`Watching ${e.activeWatchers.size} directories`)}async function p(){try{await g()}catch(e){console.error("Periodic rescan failed:",e)}}async function m(){let e=l();return e.activeWatchers.size>0?console.log(`Reusing ${e.activeWatchers.size} existing watchers (HMR-safe)`):console.log("Initializing filesystem watcher..."),await g(),e.rescanTimer&&clearInterval(e.rescanTimer),e.rescanTimer=setInterval(p,3e4),()=>{for(let t of(console.log("Cleaning up filesystem watcher..."),e.rescanTimer&&(clearInterval(e.rescanTimer),e.rescanTimer=null),e.debounceTimers.values()))clearTimeout(t);for(let t of(e.debounceTimers.clear(),e.activeWatchers.values()))t.close();e.activeWatchers.clear(),o.removeAllListeners()}}let h=(0,s.getGlobal)("__observer_server_events__",()=>new r.EventEmitter);function v(){return(0,s.getGlobal)("__observer_sse_debounce__",()=>({pendingRunDirs:new Set,timer:null,windowOpen:!1}))}function w(){let e=v(),r=Array.from(e.pendingRunDirs);if(e.pendingRunDirs.clear(),e.timer=null,e.windowOpen=!1,0===r.length)return;let n=r.map(e=>t.default.basename(e));h.emit("run-changed",{type:"run-changed",runIds:n,runDirs:r})}async function _(){let e=(0,s.getGlobal)("__observer_init__",()=>({initialized:!1,initPromise:null,cleanup:null}));if(!e.initialized)return e.initPromise||(e.initPromise=(async()=>{try{console.log("Starting server initialization..."),console.log("Setting up filesystem watcher..."),e.cleanup=await m(),console.log("Populating cache with discovered runs..."),await (0,a.discoverAndCacheAll)();let r=0;o.on("change",e=>{if("run-changed"===e.type){let r=v();if(r.windowOpen)r.pendingRunDirs.add(e.runDir),r.timer&&clearTimeout(r.timer),r.timer=setTimeout(w,500);else{r.windowOpen=!0;let n=t.default.basename(e.runDir);h.emit("run-changed",{type:"run-changed",runIds:[n],runDirs:[e.runDir]}),r.timer=setTimeout(w,500)}}else if("new-run"===e.type)h.emit("new-run",e);else if("error"===e.type){let t=Date.now();t-r>=5e3&&(r=t,h.emit("watcher-error",e))}}),e.initialized=!0,console.log("Server initialization complete")}catch(t){throw console.error("Server initialization failed:",t),e.initPromise=null,t}})()),e.initPromise}e.s(["ensureInitialized",0,_,"serverEvents",0,h],63372)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0pxt00h._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/observer-dashboard/src/lib/run-cache.ts","../../../../../packages/observer-dashboard/src/lib/global-registry.ts","../../../../../packages/observer-dashboard/src/lib/server-init.ts","../../../../../packages/observer-dashboard/src/lib/watcher.ts"],"sourcesContent":["import { getRunDigest, parseRunDir } from \"./parser\";\r\nimport type { ParseRunResult } from \"./parser\";\r\nimport { discoverAllRunDirs, type DiscoveredRun } from \"./source-discovery\";\r\nimport type { WatchSource } from \"./config-loader\";\r\nimport type { RunDigest, Run, ProjectSummary } from \"@/types\";\r\nimport { promises as fs } from \"fs\";\r\nimport path from \"path\";\r\nimport { getGlobal } from \"./global-registry\";\r\n\r\n/** Return true when err represents a \"file/directory not found\" filesystem error. */\r\nfunction isNotFoundError(err: unknown): boolean {\r\n if (!(err instanceof Error)) return false;\r\n const code = (err as NodeJS.ErrnoException).code;\r\n return code === \"ENOENT\" || code === \"ENOTDIR\" || err.message.includes(\"ENOENT\");\r\n}\r\n\r\n// Extended RunDigest with cache metadata\r\nexport interface CachedRunDigest extends RunDigest {\r\n processId: string;\r\n sourceLabel?: string;\r\n projectName?: string;\r\n}\r\n\r\ninterface CacheEntry {\r\n digest: CachedRunDigest;\r\n cachedAt: number;\r\n runDir: string;\r\n fullRun?: Run;\r\n /** Number of journal files parsed in the last full-run read — used for incremental parsing. */\r\n journalFileCount?: number;\r\n}\r\n\r\n// Persist cache across HMR reloads via typed global registry\r\nfunction getCache(): Map<string, CacheEntry> {\r\n return getGlobal('__observer_run_cache__', () => new Map<string, CacheEntry>()) as Map<string, CacheEntry>;\r\n}\r\n\r\n// Cache size limit to prevent unbounded memory growth\r\nconst MAX_CACHE_SIZE = 1000;\r\n\r\n// TTL constants\r\nconst TTL_COMPLETED = 30000; // 30s for completed runs\r\nconst TTL_ACTIVE = 5000; // 5s for active runs (waiting/pending)\r\n// Note: TTL_BREAKPOINT was removed in v0.12.3 — the aggressive 3s eviction\r\n// in getProjectSummaries() caused breakpoint banner flickering during active\r\n// orchestration (race condition with forceRefreshBreakpointRuns + discovery\r\n// debounce). The normal TTL_ACTIVE (5s) is sufficient for timely updates.\r\n\r\nfunction getTTL(status: RunDigest[\"status\"]): number {\r\n return status === \"waiting\" || status === \"pending\" ? TTL_ACTIVE : TTL_COMPLETED;\r\n}\r\n\r\nfunction isCacheValid(entry: CacheEntry): boolean {\r\n const now = Date.now();\r\n const ttl = getTTL(entry.digest.status);\r\n return now - entry.cachedAt < ttl;\r\n}\r\n\r\n// Evict oldest entries when cache exceeds MAX_CACHE_SIZE.\r\n// Evicts expired entries first, then oldest by cachedAt if still over limit.\r\nfunction evictIfNeeded(): void {\r\n const cache = getCache();\r\n if (cache.size <= MAX_CACHE_SIZE) return;\r\n\r\n // First pass: remove expired entries\r\n const now = Date.now();\r\n for (const [key, entry] of cache) {\r\n if (now - entry.cachedAt >= getTTL(entry.digest.status)) {\r\n cache.delete(key);\r\n }\r\n }\r\n if (cache.size <= MAX_CACHE_SIZE) return;\r\n\r\n // Second pass: evict oldest entries until under limit\r\n const entries = Array.from(cache.entries()).sort(\r\n ([, a], [, b]) => a.cachedAt - b.cachedAt\r\n );\r\n const toRemove = cache.size - MAX_CACHE_SIZE;\r\n for (let i = 0; i < toRemove; i++) {\r\n cache.delete(entries[i][0]);\r\n }\r\n}\r\n\r\n// Read processId and optional projectName from run.json\r\nasync function getRunJsonMeta(runDir: string): Promise<{ processId: string; projectName?: string }> {\r\n try {\r\n const runJsonPath = path.join(runDir, \"run.json\");\r\n const content = await fs.readFile(runJsonPath, \"utf-8\");\r\n const json = JSON.parse(content);\r\n return {\r\n processId: json.processId || \"unknown\",\r\n projectName: json.projectName || undefined,\r\n };\r\n } catch (err) {\r\n // ENOENT is expected for runs that haven't written run.json yet; warn on corruption or permission errors\r\n if (!isNotFoundError(err)) {\r\n console.warn(`[run-cache] Failed to read run.json metadata from ${runDir}:`, err);\r\n }\r\n return { processId: \"unknown\" };\r\n }\r\n}\r\n\r\nexport async function getDigestCached(\r\n runDir: string,\r\n source: WatchSource,\r\n projectName: string\r\n): Promise<CachedRunDigest> {\r\n const cache = getCache();\r\n const entry = cache.get(runDir);\r\n\r\n // Return cached if valid\r\n if (entry && isCacheValid(entry)) {\r\n return entry.digest;\r\n }\r\n\r\n // Cache miss — fetch fresh digest\r\n const digest = await getRunDigest(runDir);\r\n const meta = await getRunJsonMeta(runDir);\r\n\r\n // Prefer projectName from run.json over discovery-provided name\r\n const effectiveProjectName = meta.projectName || projectName;\r\n\r\n const cachedDigest: CachedRunDigest = {\r\n ...digest,\r\n processId: meta.processId,\r\n sourceLabel: source.label,\r\n projectName: effectiveProjectName,\r\n };\r\n\r\n // Update cache\r\n cache.set(runDir, {\r\n digest: cachedDigest,\r\n cachedAt: Date.now(),\r\n runDir,\r\n fullRun: entry?.fullRun, // Preserve full run if present\r\n journalFileCount: entry?.journalFileCount, // Preserve for incremental parsing\r\n });\r\n\r\n evictIfNeeded();\r\n\r\n return cachedDigest;\r\n}\r\n\r\nexport async function getRunCached(\r\n runDir: string,\r\n source: WatchSource,\r\n projectName: string\r\n): Promise<Run> {\r\n const cache = getCache();\r\n const entry = cache.get(runDir);\r\n\r\n // Return cached full run if valid and present\r\n if (entry && isCacheValid(entry) && entry.fullRun) {\r\n return entry.fullRun;\r\n }\r\n\r\n // Build incremental options from previous cache entry (if available).\r\n // This avoids re-parsing all journal files when only new events have\r\n // been appended since the last read.\r\n const incremental =\r\n entry?.fullRun && entry.journalFileCount !== undefined\r\n ? {\r\n previousEvents: entry.fullRun.events,\r\n previousFileCount: entry.journalFileCount,\r\n }\r\n : undefined;\r\n\r\n // Fetch full run (incrementally when possible)\r\n const run = await parseRunDir(runDir, incremental) as ParseRunResult;\r\n\r\n // Extract the journal file count before stripping it from the Run object\r\n const journalFileCount = run._journalFileCount;\r\n\r\n // Read run.json meta for accurate projectName\r\n const meta = await getRunJsonMeta(runDir);\r\n const effectiveProjectName = meta.projectName || projectName;\r\n\r\n // Enrich with metadata\r\n const enrichedRun: Run = {\r\n ...run,\r\n sourceLabel: source.label,\r\n projectName: effectiveProjectName,\r\n };\r\n // Remove internal field from the exposed Run object\r\n delete (enrichedRun as unknown as Record<string, unknown>)._journalFileCount;\r\n\r\n // Update cache with full run\r\n const digest = await getDigestCached(runDir, source, projectName);\r\n cache.set(runDir, {\r\n digest,\r\n cachedAt: Date.now(),\r\n runDir,\r\n fullRun: enrichedRun,\r\n journalFileCount,\r\n });\r\n\r\n evictIfNeeded();\r\n\r\n return enrichedRun;\r\n}\r\n\r\nexport function invalidateRun(runDir: string): void {\r\n getCache().delete(runDir);\r\n}\r\n\r\n/**\r\n * Force-invalidate all cached entries that have pending breakpoints.\r\n *\r\n * Design note: this intentionally checks only `pendingBreakpoints > 0` without\r\n * also requiring `waitingKind === \"breakpoint\"`. The broader condition is safer\r\n * because it ensures *any* entry that might represent a breakpoint — even one\r\n * whose waitingKind was not yet set by the parser — is evicted and refetched.\r\n * `getProjectSummaries()` applies the stricter `waitingKind === \"breakpoint\"`\r\n * filter when *counting* breakpoints for display, so the worst case of a\r\n * broader eviction here is an extra cache miss, not a false positive in the UI.\r\n */\r\nexport function forceRefreshBreakpointRuns(): void {\r\n const cache = getCache();\r\n for (const [runDir, entry] of cache) {\r\n if (entry.digest.pendingBreakpoints && entry.digest.pendingBreakpoints > 0) {\r\n cache.delete(runDir);\r\n }\r\n }\r\n}\r\n\r\nexport function invalidateAll(): void {\r\n getCache().clear();\r\n lastDiscoveryTime = 0;\r\n discoveryNeeded = true; // Force re-discovery on next request\r\n}\r\n\r\nexport function getProjectSummaries(): ProjectSummary[] {\r\n const cache = getCache();\r\n\r\n // Build project summaries from cache entries.\r\n // Breakpoint entries are only included when isCacheValid() passes (TTL_ACTIVE = 5s),\r\n // which ensures stale breakpoint data is not displayed without destructively\r\n // deleting cache entries (which caused flickering — see v0.12.3 fix).\r\n const projectMap = new Map<string, {\r\n totalRuns: number;\r\n activeRuns: number;\r\n completedRuns: number;\r\n failedRuns: number;\r\n staleRuns: number;\r\n totalTasks: number;\r\n completedTasksAggregate: number;\r\n latestUpdate: string;\r\n pendingBreakpoints: number;\r\n breakpointRuns: ProjectSummary[\"breakpointRuns\"];\r\n }>();\r\n\r\n for (const entry of cache.values()) {\r\n const projectName = entry.digest.projectName || \"Unknown\";\r\n const existing = projectMap.get(projectName) || {\r\n totalRuns: 0,\r\n activeRuns: 0,\r\n completedRuns: 0,\r\n failedRuns: 0,\r\n staleRuns: 0,\r\n totalTasks: 0,\r\n completedTasksAggregate: 0,\r\n latestUpdate: \"\",\r\n pendingBreakpoints: 0,\r\n breakpointRuns: [],\r\n };\r\n\r\n existing.totalRuns++;\r\n existing.totalTasks += entry.digest.taskCount || 0;\r\n existing.completedTasksAggregate += entry.digest.completedTasks || 0;\r\n\r\n if ((entry.digest.status === \"waiting\" || entry.digest.status === \"pending\") && !entry.digest.isStale) {\r\n existing.activeRuns++;\r\n } else if (entry.digest.status === \"completed\") {\r\n existing.completedRuns++;\r\n } else if (entry.digest.status === \"failed\") {\r\n existing.failedRuns++;\r\n }\r\n\r\n if (entry.digest.isStale) {\r\n existing.staleRuns++;\r\n }\r\n\r\n // Track pending breakpoints. Breakpoint state only changes when explicitly\r\n // approved (which calls invalidateRun), so we always count cached breakpoints\r\n // regardless of cache TTL — the TTL controls when to re-fetch data from disk,\r\n // not whether the data is valid for display. Removing the isCacheValid check\r\n // prevents breakpoint banner flickering when discovery is debounced. (v0.12.3)\r\n if (entry.digest.pendingBreakpoints && entry.digest.pendingBreakpoints > 0 &&\r\n entry.digest.waitingKind === \"breakpoint\") {\r\n existing.pendingBreakpoints += entry.digest.pendingBreakpoints;\r\n existing.breakpointRuns.push({\r\n runId: entry.digest.runId,\r\n effectId: entry.digest.breakpointEffectId || \"\",\r\n projectName,\r\n processId: entry.digest.processId || \"unknown\",\r\n breakpointQuestion: entry.digest.breakpointQuestion || \"Approval required\",\r\n });\r\n }\r\n\r\n // Track latest update\r\n if (!existing.latestUpdate || entry.digest.updatedAt > existing.latestUpdate) {\r\n existing.latestUpdate = entry.digest.updatedAt;\r\n }\r\n\r\n projectMap.set(projectName, existing);\r\n }\r\n\r\n return Array.from(projectMap.entries()).map(([projectName, stats]) => ({\r\n projectName,\r\n ...stats,\r\n }));\r\n}\r\n\r\n// Debounce discovery to avoid scanning filesystem on every poll\r\nlet lastDiscoveryTime = 0;\r\nconst DISCOVERY_DEBOUNCE_MS = 10000; // 10s — reduced from 60s to ensure new runs appear quickly\r\nlet discoveryNeeded = true; // Flag set by watcher when new runs detected\r\n\r\n// Signal that new runs may exist (called by watcher)\r\nexport function requestDiscovery(): void {\r\n discoveryNeeded = true;\r\n}\r\n\r\nexport async function discoverAndCacheAll(): Promise<void> {\r\n const cache = getCache();\r\n const now = Date.now();\r\n\r\n // If cache is populated and no new runs detected, skip expensive filesystem scan\r\n if (cache.size > 0 && !discoveryNeeded && now - lastDiscoveryTime < DISCOVERY_DEBOUNCE_MS) {\r\n return;\r\n }\r\n\r\n lastDiscoveryTime = now;\r\n discoveryNeeded = false;\r\n\r\n const discovered = await discoverAllRunDirs();\r\n\r\n // Deduplicate by run ID (basename) — discoverAllRunDirs already deduplicates\r\n // by run ID preferring directories with run.json, but guard here too in case\r\n // the same run ID somehow appears from different sources.\r\n const seen = new Set<string>();\r\n const unique = discovered.filter((d: DiscoveredRun) => {\r\n const runId = path.basename(d.runDir);\r\n if (seen.has(runId)) return false;\r\n seen.add(runId);\r\n return true;\r\n });\r\n\r\n // Build the set of valid runDir paths from discovery\r\n const validRunDirs = new Set(unique.map((d: DiscoveredRun) => d.runDir));\r\n\r\n // Prune cache entries whose runDir is no longer in the discovered set.\r\n // This removes ghost entries that were cached before dedup was applied\r\n // (e.g. a duplicate run discovered at a different path).\r\n for (const [runDir] of cache) {\r\n if (!validRunDirs.has(runDir)) {\r\n cache.delete(runDir);\r\n }\r\n }\r\n\r\n // Pre-populate cache with digests in batches to avoid overwhelming filesystem\r\n const BATCH_SIZE = 10;\r\n for (let i = 0; i < unique.length; i += BATCH_SIZE) {\r\n const batch = unique.slice(i, i + BATCH_SIZE);\r\n await Promise.all(\r\n batch.map(async (discoveredRun: DiscoveredRun) => {\r\n try {\r\n await getDigestCached(\r\n discoveredRun.runDir,\r\n discoveredRun.source,\r\n discoveredRun.projectName\r\n );\r\n } catch (err) {\r\n console.error(`Failed to cache run ${discoveredRun.runDir}:`, err);\r\n }\r\n })\r\n );\r\n }\r\n}\r\n\r\n// Return all cached digests without filesystem scanning.\r\n// Used by the digest API for fast, non-blocking responses.\r\nexport function getAllCachedDigests(): CachedRunDigest[] {\r\n const cache = getCache();\r\n const digests: CachedRunDigest[] = [];\r\n for (const entry of cache.values()) {\r\n digests.push(entry.digest);\r\n }\r\n return digests;\r\n}\r\n\r\n// Export cache for debugging\r\nexport function getCacheStats() {\r\n const cache = getCache();\r\n return {\r\n size: cache.size,\r\n entries: Array.from(cache.entries()).map(([runDir, entry]) => ({\r\n runDir,\r\n status: entry.digest.status,\r\n cachedAt: entry.cachedAt,\r\n hasFullRun: !!entry.fullRun,\r\n })),\r\n };\r\n}\r\n","/**\n * Typed GlobalRegistry — replaces raw `(globalThis as any).__key` casts with\n * type-safe accessors that persist across HMR reloads.\n *\n * Usage:\n * const cache = getGlobal('__observer_run_cache__', () => new Map<string, CacheEntry>());\n *\n * The first call lazily initialises the value on `globalThis`; subsequent calls\n * (including after HMR) return the existing instance.\n */\n\nimport type { EventEmitter } from \"events\";\nimport type { FSWatcher } from \"fs\";\n\n// ---------------------------------------------------------------------------\n// 1. Declare the shape of every key we store on globalThis.\n// Adding a new key is a compile-time-only change — just extend this map.\n// ---------------------------------------------------------------------------\n\n/**\n * Maps each globalThis key to its concrete runtime type.\n *\n * Every module that needs HMR-safe global state registers its key + type here\n * so the accessor can enforce type safety without `any` casts.\n */\nexport interface GlobalRegistryMap {\n /** run-cache.ts — Map of runDir to CacheEntry */\n __observer_run_cache__: Map<string, unknown>;\n\n /** watcher.ts — shared EventEmitter for watcher change events */\n __observer_watcher_events__: EventEmitter;\n\n /** watcher.ts — active FSWatcher instances + debounce timers */\n __observer_watchers__: {\n activeWatchers: Map<string, FSWatcher>;\n debounceTimers: Map<string, NodeJS.Timeout>;\n rescanTimer: NodeJS.Timeout | null;\n };\n\n /** server-init.ts — shared EventEmitter for SSE server events */\n __observer_server_events__: EventEmitter;\n\n /** server-init.ts — leading-edge debounce state for SSE broadcasts */\n __observer_sse_debounce__: {\n pendingRunDirs: Set<string>;\n timer: ReturnType<typeof setTimeout> | null;\n windowOpen: boolean;\n };\n\n /** server-init.ts — initialization state (singleton guard) */\n __observer_init__: {\n initialized: boolean;\n initPromise: Promise<void> | null;\n cleanup: (() => void) | null;\n };\n}\n\n// ---------------------------------------------------------------------------\n// 2. Augment the global scope so TypeScript knows about our keys.\n// ---------------------------------------------------------------------------\n\ndeclare global {\n // eslint-disable-next-line no-var -- var is required for globalThis augmentation\n var __observer_registry__: Partial<GlobalRegistryMap> | undefined;\n}\n\n// ---------------------------------------------------------------------------\n// 3. Typed accessor — the only public API.\n// ---------------------------------------------------------------------------\n\n/**\n * Return an HMR-safe global value, lazily initialising it via `factory` on\n * first access.\n *\n * The value is stored on `globalThis.__observer_registry__` under the given\n * key so it survives hot-module reloads.\n *\n * @param key One of the keys declared in {@link GlobalRegistryMap}.\n * @param factory Called once to create the initial value if it does not exist.\n * @returns The (possibly pre-existing) value.\n */\nexport function getGlobal<K extends keyof GlobalRegistryMap>(\n key: K,\n factory: () => GlobalRegistryMap[K],\n): GlobalRegistryMap[K] {\n if (!globalThis.__observer_registry__) {\n globalThis.__observer_registry__ = {};\n }\n\n const registry = globalThis.__observer_registry__;\n\n if (registry[key] === undefined) {\n registry[key] = factory();\n }\n\n return registry[key] as GlobalRegistryMap[K];\n}\n\n/**\n * Clear a single key from the global registry.\n *\n * Primarily useful during shutdown / test teardown.\n */\nexport function clearGlobal<K extends keyof GlobalRegistryMap>(key: K): void {\n if (globalThis.__observer_registry__) {\n delete globalThis.__observer_registry__[key];\n }\n}\n\n/**\n * Clear the entire global registry.\n *\n * Primarily useful in tests.\n */\nexport function clearAllGlobals(): void {\n globalThis.__observer_registry__ = undefined;\n}\n","import path from \"path\";\r\nimport { EventEmitter } from \"events\";\r\nimport { initWatcher, watcherEvents, type WatcherEvent } from \"./watcher\";\r\nimport { discoverAndCacheAll } from \"./run-cache\";\r\nimport { getGlobal } from \"./global-registry\";\r\n\r\n// Shared event bus for SSE endpoints — persist across HMR via typed global registry\r\nfunction getServerEvents(): EventEmitter {\r\n return getGlobal('__observer_server_events__', () => new EventEmitter());\r\n}\r\n\r\nexport const serverEvents = getServerEvents();\r\n\r\n// ---------------------------------------------------------------------------\r\n// Leading-edge debounce for SSE broadcasts\r\n// ---------------------------------------------------------------------------\r\n// N clients x M rapid file changes = N*M redundant API requests. This\r\n// debounce fires immediately on the *first* run-changed event (leading edge),\r\n// then collects any subsequent events within a 500ms window and emits a\r\n// single batched notification containing all affected runIds.\r\n// ---------------------------------------------------------------------------\r\n\r\nexport const SSE_DEBOUNCE_MS = 500;\r\n\r\nexport interface BatchedRunChangedEvent {\r\n type: \"run-changed\";\r\n runIds: string[];\r\n runDirs: string[];\r\n}\r\n\r\n// Persist debounce state across HMR reloads via typed global registry\r\ninterface DebounceState {\r\n pendingRunDirs: Set<string>;\r\n timer: ReturnType<typeof setTimeout> | null;\r\n /** True while we are inside a debounce window (leading edge already fired). */\r\n windowOpen: boolean;\r\n}\r\n\r\nfunction getDebounceState(): DebounceState {\r\n return getGlobal('__observer_sse_debounce__', () => ({\r\n pendingRunDirs: new Set<string>(),\r\n timer: null,\r\n windowOpen: false,\r\n }));\r\n}\r\n\r\nexport function resetDebounceState(): void {\r\n const ds = getDebounceState();\r\n if (ds.timer) clearTimeout(ds.timer);\r\n ds.timer = null;\r\n ds.pendingRunDirs.clear();\r\n ds.windowOpen = false;\r\n}\r\n\r\n/** Flush the batch — emit a single event with all collected runIds. */\r\nfunction flushBatch(): void {\r\n const ds = getDebounceState();\r\n const runDirs = Array.from(ds.pendingRunDirs);\r\n ds.pendingRunDirs.clear();\r\n ds.timer = null;\r\n ds.windowOpen = false;\r\n\r\n if (runDirs.length === 0) return;\r\n\r\n const runIds = runDirs.map((d) => path.basename(d));\r\n serverEvents.emit(\"run-changed\", {\r\n type: \"run-changed\",\r\n runIds,\r\n runDirs,\r\n } as BatchedRunChangedEvent);\r\n}\r\n\r\n/**\r\n * Enqueue a run-changed event into the leading-edge debounce.\r\n *\r\n * Behaviour:\r\n * 1. If no window is open, emit immediately (leading edge) and open window.\r\n * 2. If window is already open, collect the runDir and reset the 500ms timer\r\n * (trailing flush).\r\n */\r\nexport function enqueueRunChanged(event: WatcherEvent): void {\r\n const ds = getDebounceState();\r\n\r\n // Note: forceRefreshBreakpointRuns() was previously called here on every\r\n // watcher event, but it deleted ALL breakpoint cache entries globally —\r\n // causing banner flickering during active orchestration. The specific run\r\n // is already invalidated by invalidateRun(runDir) in the watcher handlers,\r\n // so broad cache clearing is unnecessary. (v0.12.3 fix)\r\n\r\n if (!ds.windowOpen) {\r\n // --- Leading edge: fire immediately for this single runDir ---\r\n ds.windowOpen = true;\r\n\r\n const runId = path.basename(event.runDir);\r\n serverEvents.emit(\"run-changed\", {\r\n type: \"run-changed\",\r\n runIds: [runId],\r\n runDirs: [event.runDir],\r\n } as BatchedRunChangedEvent);\r\n\r\n // Open a 500ms collection window for subsequent events\r\n ds.timer = setTimeout(flushBatch, SSE_DEBOUNCE_MS);\r\n } else {\r\n // --- Inside window: collect and reset timer ---\r\n ds.pendingRunDirs.add(event.runDir);\r\n\r\n // Reset the trailing-edge timer so the window extends on each new event\r\n if (ds.timer) clearTimeout(ds.timer);\r\n ds.timer = setTimeout(flushBatch, SSE_DEBOUNCE_MS);\r\n }\r\n}\r\n\r\n// Persist initialization state across HMR reloads via typed global registry\r\ninterface InitState {\r\n initialized: boolean;\r\n initPromise: Promise<void> | null;\r\n cleanup: (() => void) | null;\r\n}\r\n\r\nfunction getInitState(): InitState {\r\n return getGlobal('__observer_init__', () => ({\r\n initialized: false,\r\n initPromise: null,\r\n cleanup: null,\r\n }));\r\n}\r\n\r\nexport async function ensureInitialized(): Promise<void> {\r\n const state = getInitState();\r\n\r\n // Already initialized\r\n if (state.initialized) {\r\n return;\r\n }\r\n\r\n // Initialization in progress\r\n if (state.initPromise) {\r\n return state.initPromise;\r\n }\r\n\r\n // Start initialization\r\n state.initPromise = (async () => {\r\n try {\r\n console.log(\"Starting server initialization...\");\r\n\r\n // Step 1: Initialize watcher\r\n console.log(\"Setting up filesystem watcher...\");\r\n state.cleanup = await initWatcher();\r\n\r\n // Step 2: Initial cache population\r\n console.log(\"Populating cache with discovered runs...\");\r\n await discoverAndCacheAll();\r\n\r\n // Step 3: Listen to watcher events and broadcast via leading-edge debounce\r\n // Watcher already invalidates the specific run cache in handleJournalChange.\r\n // Additionally, when a journal change is detected, force-refresh all breakpoint\r\n // cache entries. This ensures that EFFECT_RESOLVED events for breakpoints\r\n // immediately clear stale breakpoint data across all cached runs — not just\r\n // the specific run that changed.\r\n //\r\n // run-changed events are routed through enqueueRunChanged() which implements\r\n // a 500ms leading-edge debounce: the first event fires immediately, then\r\n // subsequent events within the window are batched and flushed once.\r\n\r\n // Dedup window for transient watcher errors — suppress duplicates within 5s\r\n // to prevent cascading SSE error events that trigger client-side flash\r\n let lastWatcherErrorTime = 0;\r\n const WATCHER_ERROR_DEDUP_MS = 5000;\r\n\r\n watcherEvents.on(\"change\", (event: WatcherEvent) => {\r\n if (event.type === \"run-changed\") {\r\n enqueueRunChanged(event);\r\n } else if (event.type === \"new-run\") {\r\n serverEvents.emit(\"new-run\", event);\r\n } else if (event.type === \"error\") {\r\n // Suppress transient watcher errors within dedup window\r\n const now = Date.now();\r\n if (now - lastWatcherErrorTime >= WATCHER_ERROR_DEDUP_MS) {\r\n lastWatcherErrorTime = now;\r\n serverEvents.emit(\"watcher-error\", event);\r\n }\r\n }\r\n });\r\n\r\n state.initialized = true;\r\n console.log(\"Server initialization complete\");\r\n } catch (err) {\r\n console.error(\"Server initialization failed:\", err);\r\n state.initPromise = null;\r\n throw err;\r\n }\r\n })();\r\n\r\n return state.initPromise;\r\n}\r\n\r\n// Cleanup function for graceful shutdown\r\nexport async function shutdownServer(): Promise<void> {\r\n const state = getInitState();\r\n\r\n if (state.cleanup) {\r\n state.cleanup();\r\n state.cleanup = null;\r\n }\r\n\r\n state.initialized = false;\r\n state.initPromise = null;\r\n\r\n // Clear SSE debounce timers\r\n resetDebounceState();\r\n\r\n // Remove all event listeners\r\n serverEvents.removeAllListeners();\r\n\r\n console.log(\"Server shutdown complete\");\r\n}\r\n\r\n// Get initialization status for debugging\r\nexport function getInitStatus() {\r\n const state = getInitState();\r\n return {\r\n initialized: state.initialized,\r\n hasCleanup: !!state.cleanup,\r\n serverEventListeners: serverEvents.eventNames().length,\r\n };\r\n}\r\n","import { watch, type FSWatcher } from \"fs\";\r\nimport { promises as fs } from \"fs\";\r\nimport path from \"path\";\r\nimport { EventEmitter } from \"events\";\r\nimport { discoverAllRunDirs, invalidateDiscoveryCache, discoverAllRunsParentDirs } from \"./source-discovery\";\r\nimport { invalidateRun, requestDiscovery } from \"./run-cache\";\r\nimport { getGlobal } from \"./global-registry\";\r\n\r\n// Persist event emitter across HMR reloads via typed global registry\r\nfunction getWatcherEvents(): EventEmitter {\r\n return getGlobal('__observer_watcher_events__', () => new EventEmitter());\r\n}\r\n\r\nexport const watcherEvents = getWatcherEvents();\r\n\r\n// Event types\r\nexport type WatcherEventType = \"run-changed\" | \"new-run\" | \"error\";\r\n\r\nexport interface WatcherEvent {\r\n type: WatcherEventType;\r\n runDir: string;\r\n error?: Error;\r\n}\r\n\r\n// Persist watcher state across HMR reloads via typed global registry\r\ninterface WatcherState {\r\n activeWatchers: Map<string, FSWatcher>;\r\n debounceTimers: Map<string, NodeJS.Timeout>;\r\n rescanTimer: NodeJS.Timeout | null;\r\n}\r\n\r\nfunction getWatcherState(): WatcherState {\r\n return getGlobal('__observer_watchers__', () => ({\r\n activeWatchers: new Map<string, FSWatcher>(),\r\n debounceTimers: new Map<string, NodeJS.Timeout>(),\r\n rescanTimer: null,\r\n }));\r\n}\r\n\r\n// WSL-optimized constants\r\nconst DEBOUNCE_MS = 500; // 500ms debounce (WSL cross-FS needs more)\r\nconst RESCAN_INTERVAL_MS = 30000; // 30s — reduced from 120s to detect new project directories faster\r\n\r\nfunction debounceChange(runDir: string, callback: () => void) {\r\n const state = getWatcherState();\r\n const existing = state.debounceTimers.get(runDir);\r\n if (existing) {\r\n clearTimeout(existing);\r\n }\r\n\r\n const timer = setTimeout(() => {\r\n state.debounceTimers.delete(runDir);\r\n callback();\r\n }, DEBOUNCE_MS);\r\n\r\n state.debounceTimers.set(runDir, timer);\r\n}\r\n\r\nfunction handleJournalChange(journalDir: string) {\r\n const runDir = path.dirname(journalDir);\r\n\r\n debounceChange(runDir, () => {\r\n invalidateRun(runDir);\r\n requestDiscovery(); // Ensure discoverAndCacheAll() re-populates the entry\r\n watcherEvents.emit(\"change\", {\r\n type: \"run-changed\",\r\n runDir,\r\n } as WatcherEvent);\r\n });\r\n}\r\n\r\nfunction handleTasksChange(tasksDir: string) {\r\n const runDir = path.dirname(tasksDir);\r\n\r\n debounceChange(runDir, () => {\r\n invalidateRun(runDir);\r\n requestDiscovery(); // Ensure discoverAndCacheAll() re-populates the entry\r\n watcherEvents.emit(\"change\", {\r\n type: \"run-changed\",\r\n runDir,\r\n } as WatcherEvent);\r\n });\r\n}\r\n\r\nfunction handleRunsParentChange(runsDir: string) {\r\n debounceChange(runsDir, () => {\r\n // Invalidate caches so new runs are picked up on next request\r\n invalidateDiscoveryCache();\r\n requestDiscovery();\r\n watcherEvents.emit(\"change\", {\r\n type: \"new-run\",\r\n runDir: runsDir,\r\n } as WatcherEvent);\r\n });\r\n}\r\n\r\nfunction watchDirectory(dirPath: string, onChange: (path: string) => void): FSWatcher | null {\r\n try {\r\n // Use non-recursive watch (WSL doesn't support recursive)\r\n const watcher = watch(dirPath, { recursive: false }, (eventType, filename) => {\r\n if (filename) {\r\n onChange(dirPath);\r\n }\r\n });\r\n\r\n watcher.on(\"error\", (err) => {\r\n console.error(`Watch error for ${dirPath}:`, err);\r\n watcherEvents.emit(\"change\", {\r\n type: \"error\",\r\n runDir: dirPath,\r\n error: err,\r\n } as WatcherEvent);\r\n });\r\n\r\n return watcher;\r\n } catch (err) {\r\n console.error(`Failed to watch ${dirPath}:`, err);\r\n return null;\r\n }\r\n}\r\n\r\nasync function setupWatchers() {\r\n const state = getWatcherState();\r\n const discovered = await discoverAllRunDirs();\r\n const runsParentDirs = new Set<string>();\r\n\r\n // Build the set of directories we need to watch\r\n const neededDirs = new Set<string>();\r\n\r\n for (const { runDir } of discovered) {\r\n const journalDir = path.join(runDir, \"journal\");\r\n try {\r\n await fs.access(journalDir);\r\n neededDirs.add(journalDir);\r\n } catch {\r\n // Journal dir doesn't exist yet — skip for now\r\n }\r\n\r\n const tasksDir = path.join(runDir, \"tasks\");\r\n try {\r\n await fs.access(tasksDir);\r\n neededDirs.add(tasksDir);\r\n } catch {\r\n // Tasks dir doesn't exist yet — skip for now\r\n }\r\n\r\n const runsDir = path.dirname(runDir);\r\n runsParentDirs.add(runsDir);\r\n }\r\n\r\n // Also discover ALL .a5c/runs/ directories (including empty ones)\r\n // so we detect the very first run in a new project immediately\r\n try {\r\n const allRunsParentDirs = await discoverAllRunsParentDirs();\r\n for (const dir of allRunsParentDirs) {\r\n runsParentDirs.add(dir);\r\n }\r\n } catch {\r\n // Non-critical — fall back to watching only populated runs dirs\r\n }\r\n\r\n for (const runsDir of runsParentDirs) {\r\n try {\r\n await fs.access(runsDir);\r\n neededDirs.add(runsDir);\r\n } catch {\r\n // Runs dir doesn't exist\r\n }\r\n }\r\n\r\n // Incremental update: close watchers for directories no longer needed\r\n for (const [dirPath, watcher] of state.activeWatchers.entries()) {\r\n if (!neededDirs.has(dirPath)) {\r\n watcher.close();\r\n state.activeWatchers.delete(dirPath);\r\n }\r\n }\r\n\r\n // Only create new watchers for newly discovered directories\r\n for (const dirPath of neededDirs) {\r\n if (!state.activeWatchers.has(dirPath)) {\r\n const baseName = path.basename(dirPath);\r\n const isJournalDir = baseName === \"journal\";\r\n const isTasksDir = baseName === \"tasks\";\r\n const onChange = isJournalDir\r\n ? handleJournalChange\r\n : isTasksDir\r\n ? handleTasksChange\r\n : handleRunsParentChange;\r\n const watcher = watchDirectory(dirPath, onChange);\r\n if (watcher) {\r\n state.activeWatchers.set(dirPath, watcher);\r\n }\r\n }\r\n }\r\n\r\n console.log(`Watching ${state.activeWatchers.size} directories`);\r\n}\r\n\r\nasync function periodicRescan() {\r\n try {\r\n // Re-discover and update watchers incrementally\r\n await setupWatchers();\r\n } catch (err) {\r\n console.error(\"Periodic rescan failed:\", err);\r\n }\r\n}\r\n\r\nexport async function initWatcher(): Promise<() => void> {\r\n const state = getWatcherState();\r\n\r\n // If watchers already exist from a previous HMR cycle, skip full re-init\r\n if (state.activeWatchers.size > 0) {\r\n console.log(`Reusing ${state.activeWatchers.size} existing watchers (HMR-safe)`);\r\n // Still do an incremental rescan to pick up any new directories\r\n await setupWatchers();\r\n } else {\r\n console.log(\"Initializing filesystem watcher...\");\r\n await setupWatchers();\r\n }\r\n\r\n // Clear any existing rescan timer before setting a new one\r\n if (state.rescanTimer) {\r\n clearInterval(state.rescanTimer);\r\n }\r\n\r\n // Schedule periodic rescans\r\n state.rescanTimer = setInterval(periodicRescan, RESCAN_INTERVAL_MS);\r\n\r\n // Return cleanup function\r\n return () => {\r\n console.log(\"Cleaning up filesystem watcher...\");\r\n\r\n // Clear rescan timer\r\n if (state.rescanTimer) {\r\n clearInterval(state.rescanTimer);\r\n state.rescanTimer = null;\r\n }\r\n\r\n // Clear debounce timers\r\n for (const timer of state.debounceTimers.values()) {\r\n clearTimeout(timer);\r\n }\r\n state.debounceTimers.clear();\r\n\r\n // Close all watchers\r\n for (const watcher of state.activeWatchers.values()) {\r\n watcher.close();\r\n }\r\n state.activeWatchers.clear();\r\n\r\n // Remove all event listeners\r\n watcherEvents.removeAllListeners();\r\n };\r\n}\r\n\r\n// Get watcher stats for debugging\r\nexport function getWatcherStats() {\r\n const state = getWatcherState();\r\n return {\r\n activeWatchers: state.activeWatchers.size,\r\n watchedPaths: Array.from(state.activeWatchers.keys()),\r\n pendingDebounces: state.debounceTimers.size,\r\n };\r\n}\r\n"],"names":["getGlobal","key","factory","globalThis","__observer_registry__","registry","undefined","clearGlobal","clearAllGlobals","getWatcherEvents","watcherEvents","getWatcherState","activeWatchers","Map","debounceTimers","rescanTimer","DEBOUNCE_MS","RESCAN_INTERVAL_MS","debounceChange","runDir","callback","state","existing","get","clearTimeout","timer","setTimeout","delete","set","handleJournalChange","journalDir","dirname","emit","type","handleTasksChange","tasksDir","handleRunsParentChange","runsDir","watchDirectory","dirPath","onChange","watcher","recursive","eventType","filename","on","err","console","error","setupWatchers","discovered","runsParentDirs","Set","neededDirs","join","access","add","allRunsParentDirs","dir","entries","has","close","baseName","basename","isJournalDir","isTasksDir","log","size","periodicRescan","initWatcher","clearInterval","setInterval","values","clear","removeAllListeners","getWatcherStats","watchedPaths","Array","from","keys","pendingDebounces"],"mappings":"6CAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEA,EAAA,EAAA,CAAA,CAAA,OAGA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OC2EO,SAASA,EACdC,CAAM,CACNC,CAAmC,EAE/B,AAACC,WAAWC,qBAAqB,EAAE,CACrCD,WAAWC,qBAAqB,CAAG,EAAC,EAGtC,IAAMC,EAAWF,WAAWC,qBAAqB,CAMjD,YAJsBE,IAAlBD,CAAQ,CAACJ,EAAI,GAAgB,AAC/BI,CAAQ,CAACJ,EAAI,CAAGC,GAAAA,EAGXG,CAAQ,CAACJ,EAAI,AACtB,CD/DA,SAAS,IACP,OAAO,EAAU,yBAA0B,IAAM,IAAI,IACvD,CAaA,SAAS,EAAO,CAA2B,EACzC,MAAkB,YAAX,GAAmC,YAAX,AAAuB,EAPrC,IADG,EACG,CAQzB,CAEA,GAHqE,AARxC,MAWpB,EAAa,CAAiB,EACrC,IAAM,EAAM,KAAK,GAAG,AAZgC,GAa9C,EAAM,EAAO,EAAM,AAZqC,MAY/B,CAAC,MAAM,EACtC,OAAO,EAAM,EAAM,QAAQ,CAAG,CAChC,CAIA,SAA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K,IAgF7B,CAqE0BE,KAtEU,CAC7B,AAsEM,GAAmB,WAAW,CAA1B,EAAM,IAAI,CACnB,EAAa,IAAI,CAAC,UAAW,QACxB,GAAmB,UAAf,EAAM,IAAI,CAAc,CAEjC,IAAM,EAAM,KAAK,GAAG,GAChB,EAAM,GAViB,MAWzB,EAAuB,EACvB,EAAa,IAAI,CAAC,IAFcpC,YAEG,GAEvC,CACF,GAEA,EAAM,GAPwD,QAO7C,EAAG,EACpB,QAAQ,GAAG,CAAC,iCACd,CAAE,MAAO,EAAK,CAGZ,MAFA,QAAQ,KAAK,CAAC,gCAAiC,GAC/C,EAAM,WAAW,CAAG,KACd,CACR,EACF,CAAC,EAAA,EAtDQ,EAAM,WAAW,AAyD5B"}
@@ -0,0 +1,3 @@
1
+ module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},36111,19903,e=>{"use strict";var t=e.i(40564),r=e.i(75619),n=e.i(22734),i=e.i(14747);function a(e,t){globalThis.__observer_registry__||(globalThis.__observer_registry__={});let r=globalThis.__observer_registry__;return void 0===r[e]&&(r[e]=t()),r[e]}function s(){return a("__observer_run_cache__",()=>new Map)}function o(e){return"waiting"===e||"pending"===e?5e3:3e4}function l(e){let t=Date.now(),r=o(e.digest.status);return t-e.cachedAt<r}function c(){let e=s();if(e.size<=1e3)return;let t=Date.now();for(let[r,n]of e)t-n.cachedAt>=o(n.digest.status)&&e.delete(r);if(e.size<=1e3)return;let r=Array.from(e.entries()).sort(([,e],[,t])=>e.cachedAt-t.cachedAt),n=e.size-1e3;for(let t=0;t<n;t++)e.delete(r[t][0])}async function u(e){try{let t=i.default.join(e,"run.json"),r=await n.promises.readFile(t,"utf-8"),a=JSON.parse(r);return{processId:a.processId||"unknown",projectName:a.projectName||void 0}}catch(t){return!function(e){if(!(e instanceof Error))return!1;let t=e.code;return"ENOENT"===t||"ENOTDIR"===t||e.message.includes("ENOENT")}(t)&&console.warn(`[run-cache] Failed to read run.json metadata from ${e}:`,t),{processId:"unknown"}}}async function d(e,r,n){let i=s(),a=i.get(e);if(a&&l(a))return a.digest;let o=await (0,t.getRunDigest)(e),d=await u(e),p=d.projectName||n,f={...o,processId:d.processId,sourceLabel:r.label,projectName:p};return i.set(e,{digest:f,cachedAt:Date.now(),runDir:e,fullRun:a?.fullRun,journalFileCount:a?.journalFileCount}),c(),f}async function p(e,r,n){let i=s(),a=i.get(e);if(a&&l(a)&&a.fullRun)return a.fullRun;let o=a?.fullRun&&void 0!==a.journalFileCount?{previousEvents:a.fullRun.events,previousFileCount:a.journalFileCount}:void 0,p=await (0,t.parseRunDir)(e,o),f=p._journalFileCount,g=(await u(e)).projectName||n,m={...p,sourceLabel:r.label,projectName:g};delete m._journalFileCount;let v=await d(e,r,n);return i.set(e,{digest:v,cachedAt:Date.now(),runDir:e,fullRun:m,journalFileCount:f}),c(),m}e.s(["getGlobal",0,a],19903);let f=0,g=!0;async function m(){let e=s(),t=Date.now();if(e.size>0&&!g&&t-f<1e4)return;f=t,g=!1;let n=await (0,r.discoverAllRunDirs)(),a=new Set,o=n.filter(e=>{let t=i.default.basename(e.runDir);return!a.has(t)&&(a.add(t),!0)}),l=new Set(o.map(e=>e.runDir));for(let[t]of e)l.has(t)||e.delete(t);for(let e=0;e<o.length;e+=10){let t=o.slice(e,e+10);await Promise.all(t.map(async e=>{try{await d(e.runDir,e.source,e.projectName)}catch(t){console.error(`Failed to cache run ${e.runDir}:`,t)}}))}}e.s(["discoverAndCacheAll",0,m,"getAllCachedDigests",0,function(){let e=s(),t=[];for(let r of e.values())t.push(r.digest);return t},"getProjectSummaries",0,function(){let e=s(),t=new Map;for(let r of e.values()){let e=r.digest.projectName||"Unknown",n=t.get(e)||{totalRuns:0,activeRuns:0,completedRuns:0,failedRuns:0,staleRuns:0,totalTasks:0,completedTasksAggregate:0,latestUpdate:"",pendingBreakpoints:0,breakpointRuns:[]};n.totalRuns++,n.totalTasks+=r.digest.taskCount||0,n.completedTasksAggregate+=r.digest.completedTasks||0,"waiting"!==r.digest.status&&"pending"!==r.digest.status||r.digest.isStale?"completed"===r.digest.status?n.completedRuns++:"failed"===r.digest.status&&n.failedRuns++:n.activeRuns++,r.digest.isStale&&n.staleRuns++,r.digest.pendingBreakpoints&&r.digest.pendingBreakpoints>0&&"breakpoint"===r.digest.waitingKind&&(n.pendingBreakpoints+=r.digest.pendingBreakpoints,n.breakpointRuns.push({runId:r.digest.runId,effectId:r.digest.breakpointEffectId||"",projectName:e,processId:r.digest.processId||"unknown",breakpointQuestion:r.digest.breakpointQuestion||"Approval required"})),(!n.latestUpdate||r.digest.updatedAt>n.latestUpdate)&&(n.latestUpdate=r.digest.updatedAt),t.set(e,n)}return Array.from(t.entries()).map(([e,t])=>({projectName:e,...t}))},"getRunCached",0,p,"invalidateAll",0,function(){s().clear(),f=0,g=!0},"invalidateRun",0,function(e){s().delete(e)},"requestDiscovery",0,function(){g=!0}],36111)},27699,(e,t,r)=>{t.exports=e.x("events",()=>require("events"))},63372,e=>{"use strict";var t=e.i(14747),r=e.i(27699),n=e.i(22734),i=e.i(75619),a=e.i(36111),s=e.i(19903);let o=(0,s.getGlobal)("__observer_watcher_events__",()=>new r.EventEmitter);function l(){return(0,s.getGlobal)("__observer_watchers__",()=>({activeWatchers:new Map,debounceTimers:new Map,rescanTimer:null}))}function c(e,t){let r=l(),n=r.debounceTimers.get(e);n&&clearTimeout(n);let i=setTimeout(()=>{r.debounceTimers.delete(e),t()},500);r.debounceTimers.set(e,i)}function u(e){let r=t.default.dirname(e);c(r,()=>{(0,a.invalidateRun)(r),(0,a.requestDiscovery)(),o.emit("change",{type:"run-changed",runDir:r})})}function d(e){let r=t.default.dirname(e);c(r,()=>{(0,a.invalidateRun)(r),(0,a.requestDiscovery)(),o.emit("change",{type:"run-changed",runDir:r})})}function p(e){c(e,()=>{(0,i.invalidateDiscoveryCache)(),(0,a.requestDiscovery)(),o.emit("change",{type:"new-run",runDir:e})})}async function f(){let e=l(),r=await (0,i.discoverAllRunDirs)(),a=new Set,s=new Set;for(let{runDir:e}of r){let r=t.default.join(e,"journal");try{await n.promises.access(r),s.add(r)}catch{}let i=t.default.join(e,"tasks");try{await n.promises.access(i),s.add(i)}catch{}let o=t.default.dirname(e);a.add(o)}try{for(let e of(await (0,i.discoverAllRunsParentDirs)()))a.add(e)}catch{}for(let e of a)try{await n.promises.access(e),s.add(e)}catch{}for(let[t,r]of e.activeWatchers.entries())s.has(t)||(r.close(),e.activeWatchers.delete(t));for(let r of s)if(!e.activeWatchers.has(r)){let i=t.default.basename(r),a="journal"===i,s="tasks"===i,l=function(e,t){try{let r=(0,n.watch)(e,{recursive:!1},(r,n)=>{n&&t(e)});return r.on("error",t=>{console.error(`Watch error for ${e}:`,t),o.emit("change",{type:"error",runDir:e,error:t})}),r}catch(t){return console.error(`Failed to watch ${e}:`,t),null}}(r,a?u:s?d:p);l&&e.activeWatchers.set(r,l)}console.log(`Watching ${e.activeWatchers.size} directories`)}async function g(){try{await f()}catch(e){console.error("Periodic rescan failed:",e)}}async function m(){let e=l();return e.activeWatchers.size>0?console.log(`Reusing ${e.activeWatchers.size} existing watchers (HMR-safe)`):console.log("Initializing filesystem watcher..."),await f(),e.rescanTimer&&clearInterval(e.rescanTimer),e.rescanTimer=setInterval(g,3e4),()=>{for(let t of(console.log("Cleaning up filesystem watcher..."),e.rescanTimer&&(clearInterval(e.rescanTimer),e.rescanTimer=null),e.debounceTimers.values()))clearTimeout(t);for(let t of(e.debounceTimers.clear(),e.activeWatchers.values()))t.close();e.activeWatchers.clear(),o.removeAllListeners()}}let v=(0,s.getGlobal)("__observer_server_events__",()=>new r.EventEmitter);function h(){return(0,s.getGlobal)("__observer_sse_debounce__",()=>({pendingRunDirs:new Set,timer:null,windowOpen:!1}))}function w(){let e=h(),r=Array.from(e.pendingRunDirs);if(e.pendingRunDirs.clear(),e.timer=null,e.windowOpen=!1,0===r.length)return;let n=r.map(e=>t.default.basename(e));v.emit("run-changed",{type:"run-changed",runIds:n,runDirs:r})}async function _(){let e=(0,s.getGlobal)("__observer_init__",()=>({initialized:!1,initPromise:null,cleanup:null}));if(!e.initialized)return e.initPromise||(e.initPromise=(async()=>{try{console.log("Starting server initialization..."),console.log("Setting up filesystem watcher..."),e.cleanup=await m(),console.log("Populating cache with discovered runs..."),await (0,a.discoverAndCacheAll)();let r=0;o.on("change",e=>{if("run-changed"===e.type){let r=h();if(r.windowOpen)r.pendingRunDirs.add(e.runDir),r.timer&&clearTimeout(r.timer),r.timer=setTimeout(w,500);else{r.windowOpen=!0;let n=t.default.basename(e.runDir);v.emit("run-changed",{type:"run-changed",runIds:[n],runDirs:[e.runDir]}),r.timer=setTimeout(w,500)}}else if("new-run"===e.type)v.emit("new-run",e);else if("error"===e.type){let t=Date.now();t-r>=5e3&&(r=t,v.emit("watcher-error",e))}}),e.initialized=!0,console.log("Server initialization complete")}catch(t){throw console.error("Server initialization failed:",t),e.initPromise=null,t}})()),e.initPromise}e.s(["ensureInitialized",0,_,"serverEvents",0,v],63372)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0rubnza._.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../packages/observer-dashboard/src/lib/run-cache.ts","../../../../../packages/observer-dashboard/src/lib/global-registry.ts","../../../../../packages/observer-dashboard/src/lib/server-init.ts","../../../../../packages/observer-dashboard/src/lib/watcher.ts"],"sourcesContent":["import { getRunDigest, parseRunDir } from \"./parser\";\r\nimport type { ParseRunResult } from \"./parser\";\r\nimport { discoverAllRunDirs, type DiscoveredRun } from \"./source-discovery\";\r\nimport type { WatchSource } from \"./config-loader\";\r\nimport type { RunDigest, Run, ProjectSummary } from \"@/types\";\r\nimport { promises as fs } from \"fs\";\r\nimport path from \"path\";\r\nimport { getGlobal } from \"./global-registry\";\r\n\r\n/** Return true when err represents a \"file/directory not found\" filesystem error. */\r\nfunction isNotFoundError(err: unknown): boolean {\r\n if (!(err instanceof Error)) return false;\r\n const code = (err as NodeJS.ErrnoException).code;\r\n return code === \"ENOENT\" || code === \"ENOTDIR\" || err.message.includes(\"ENOENT\");\r\n}\r\n\r\n// Extended RunDigest with cache metadata\r\nexport interface CachedRunDigest extends RunDigest {\r\n processId: string;\r\n sourceLabel?: string;\r\n projectName?: string;\r\n}\r\n\r\ninterface CacheEntry {\r\n digest: CachedRunDigest;\r\n cachedAt: number;\r\n runDir: string;\r\n fullRun?: Run;\r\n /** Number of journal files parsed in the last full-run read — used for incremental parsing. */\r\n journalFileCount?: number;\r\n}\r\n\r\n// Persist cache across HMR reloads via typed global registry\r\nfunction getCache(): Map<string, CacheEntry> {\r\n return getGlobal('__observer_run_cache__', () => new Map<string, CacheEntry>()) as Map<string, CacheEntry>;\r\n}\r\n\r\n// Cache size limit to prevent unbounded memory growth\r\nconst MAX_CACHE_SIZE = 1000;\r\n\r\n// TTL constants\r\nconst TTL_COMPLETED = 30000; // 30s for completed runs\r\nconst TTL_ACTIVE = 5000; // 5s for active runs (waiting/pending)\r\n// Note: TTL_BREAKPOINT was removed in v0.12.3 — the aggressive 3s eviction\r\n// in getProjectSummaries() caused breakpoint banner flickering during active\r\n// orchestration (race condition with forceRefreshBreakpointRuns + discovery\r\n// debounce). The normal TTL_ACTIVE (5s) is sufficient for timely updates.\r\n\r\nfunction getTTL(status: RunDigest[\"status\"]): number {\r\n return status === \"waiting\" || status === \"pending\" ? TTL_ACTIVE : TTL_COMPLETED;\r\n}\r\n\r\nfunction isCacheValid(entry: CacheEntry): boolean {\r\n const now = Date.now();\r\n const ttl = getTTL(entry.digest.status);\r\n return now - entry.cachedAt < ttl;\r\n}\r\n\r\n// Evict oldest entries when cache exceeds MAX_CACHE_SIZE.\r\n// Evicts expired entries first, then oldest by cachedAt if still over limit.\r\nfunction evictIfNeeded(): void {\r\n const cache = getCache();\r\n if (cache.size <= MAX_CACHE_SIZE) return;\r\n\r\n // First pass: remove expired entries\r\n const now = Date.now();\r\n for (const [key, entry] of cache) {\r\n if (now - entry.cachedAt >= getTTL(entry.digest.status)) {\r\n cache.delete(key);\r\n }\r\n }\r\n if (cache.size <= MAX_CACHE_SIZE) return;\r\n\r\n // Second pass: evict oldest entries until under limit\r\n const entries = Array.from(cache.entries()).sort(\r\n ([, a], [, b]) => a.cachedAt - b.cachedAt\r\n );\r\n const toRemove = cache.size - MAX_CACHE_SIZE;\r\n for (let i = 0; i < toRemove; i++) {\r\n cache.delete(entries[i][0]);\r\n }\r\n}\r\n\r\n// Read processId and optional projectName from run.json\r\nasync function getRunJsonMeta(runDir: string): Promise<{ processId: string; projectName?: string }> {\r\n try {\r\n const runJsonPath = path.join(runDir, \"run.json\");\r\n const content = await fs.readFile(runJsonPath, \"utf-8\");\r\n const json = JSON.parse(content);\r\n return {\r\n processId: json.processId || \"unknown\",\r\n projectName: json.projectName || undefined,\r\n };\r\n } catch (err) {\r\n // ENOENT is expected for runs that haven't written run.json yet; warn on corruption or permission errors\r\n if (!isNotFoundError(err)) {\r\n console.warn(`[run-cache] Failed to read run.json metadata from ${runDir}:`, err);\r\n }\r\n return { processId: \"unknown\" };\r\n }\r\n}\r\n\r\nexport async function getDigestCached(\r\n runDir: string,\r\n source: WatchSource,\r\n projectName: string\r\n): Promise<CachedRunDigest> {\r\n const cache = getCache();\r\n const entry = cache.get(runDir);\r\n\r\n // Return cached if valid\r\n if (entry && isCacheValid(entry)) {\r\n return entry.digest;\r\n }\r\n\r\n // Cache miss — fetch fresh digest\r\n const digest = await getRunDigest(runDir);\r\n const meta = await getRunJsonMeta(runDir);\r\n\r\n // Prefer projectName from run.json over discovery-provided name\r\n const effectiveProjectName = meta.projectName || projectName;\r\n\r\n const cachedDigest: CachedRunDigest = {\r\n ...digest,\r\n processId: meta.processId,\r\n sourceLabel: source.label,\r\n projectName: effectiveProjectName,\r\n };\r\n\r\n // Update cache\r\n cache.set(runDir, {\r\n digest: cachedDigest,\r\n cachedAt: Date.now(),\r\n runDir,\r\n fullRun: entry?.fullRun, // Preserve full run if present\r\n journalFileCount: entry?.journalFileCount, // Preserve for incremental parsing\r\n });\r\n\r\n evictIfNeeded();\r\n\r\n return cachedDigest;\r\n}\r\n\r\nexport async function getRunCached(\r\n runDir: string,\r\n source: WatchSource,\r\n projectName: string\r\n): Promise<Run> {\r\n const cache = getCache();\r\n const entry = cache.get(runDir);\r\n\r\n // Return cached full run if valid and present\r\n if (entry && isCacheValid(entry) && entry.fullRun) {\r\n return entry.fullRun;\r\n }\r\n\r\n // Build incremental options from previous cache entry (if available).\r\n // This avoids re-parsing all journal files when only new events have\r\n // been appended since the last read.\r\n const incremental =\r\n entry?.fullRun && entry.journalFileCount !== undefined\r\n ? {\r\n previousEvents: entry.fullRun.events,\r\n previousFileCount: entry.journalFileCount,\r\n }\r\n : undefined;\r\n\r\n // Fetch full run (incrementally when possible)\r\n const run = await parseRunDir(runDir, incremental) as ParseRunResult;\r\n\r\n // Extract the journal file count before stripping it from the Run object\r\n const journalFileCount = run._journalFileCount;\r\n\r\n // Read run.json meta for accurate projectName\r\n const meta = await getRunJsonMeta(runDir);\r\n const effectiveProjectName = meta.projectName || projectName;\r\n\r\n // Enrich with metadata\r\n const enrichedRun: Run = {\r\n ...run,\r\n sourceLabel: source.label,\r\n projectName: effectiveProjectName,\r\n };\r\n // Remove internal field from the exposed Run object\r\n delete (enrichedRun as unknown as Record<string, unknown>)._journalFileCount;\r\n\r\n // Update cache with full run\r\n const digest = await getDigestCached(runDir, source, projectName);\r\n cache.set(runDir, {\r\n digest,\r\n cachedAt: Date.now(),\r\n runDir,\r\n fullRun: enrichedRun,\r\n journalFileCount,\r\n });\r\n\r\n evictIfNeeded();\r\n\r\n return enrichedRun;\r\n}\r\n\r\nexport function invalidateRun(runDir: string): void {\r\n getCache().delete(runDir);\r\n}\r\n\r\n/**\r\n * Force-invalidate all cached entries that have pending breakpoints.\r\n *\r\n * Design note: this intentionally checks only `pendingBreakpoints > 0` without\r\n * also requiring `waitingKind === \"breakpoint\"`. The broader condition is safer\r\n * because it ensures *any* entry that might represent a breakpoint — even one\r\n * whose waitingKind was not yet set by the parser — is evicted and refetched.\r\n * `getProjectSummaries()` applies the stricter `waitingKind === \"breakpoint\"`\r\n * filter when *counting* breakpoints for display, so the worst case of a\r\n * broader eviction here is an extra cache miss, not a false positive in the UI.\r\n */\r\nexport function forceRefreshBreakpointRuns(): void {\r\n const cache = getCache();\r\n for (const [runDir, entry] of cache) {\r\n if (entry.digest.pendingBreakpoints && entry.digest.pendingBreakpoints > 0) {\r\n cache.delete(runDir);\r\n }\r\n }\r\n}\r\n\r\nexport function invalidateAll(): void {\r\n getCache().clear();\r\n lastDiscoveryTime = 0;\r\n discoveryNeeded = true; // Force re-discovery on next request\r\n}\r\n\r\nexport function getProjectSummaries(): ProjectSummary[] {\r\n const cache = getCache();\r\n\r\n // Build project summaries from cache entries.\r\n // Breakpoint entries are only included when isCacheValid() passes (TTL_ACTIVE = 5s),\r\n // which ensures stale breakpoint data is not displayed without destructively\r\n // deleting cache entries (which caused flickering — see v0.12.3 fix).\r\n const projectMap = new Map<string, {\r\n totalRuns: number;\r\n activeRuns: number;\r\n completedRuns: number;\r\n failedRuns: number;\r\n staleRuns: number;\r\n totalTasks: number;\r\n completedTasksAggregate: number;\r\n latestUpdate: string;\r\n pendingBreakpoints: number;\r\n breakpointRuns: ProjectSummary[\"breakpointRuns\"];\r\n }>();\r\n\r\n for (const entry of cache.values()) {\r\n const projectName = entry.digest.projectName || \"Unknown\";\r\n const existing = projectMap.get(projectName) || {\r\n totalRuns: 0,\r\n activeRuns: 0,\r\n completedRuns: 0,\r\n failedRuns: 0,\r\n staleRuns: 0,\r\n totalTasks: 0,\r\n completedTasksAggregate: 0,\r\n latestUpdate: \"\",\r\n pendingBreakpoints: 0,\r\n breakpointRuns: [],\r\n };\r\n\r\n existing.totalRuns++;\r\n existing.totalTasks += entry.digest.taskCount || 0;\r\n existing.completedTasksAggregate += entry.digest.completedTasks || 0;\r\n\r\n if ((entry.digest.status === \"waiting\" || entry.digest.status === \"pending\") && !entry.digest.isStale) {\r\n existing.activeRuns++;\r\n } else if (entry.digest.status === \"completed\") {\r\n existing.completedRuns++;\r\n } else if (entry.digest.status === \"failed\") {\r\n existing.failedRuns++;\r\n }\r\n\r\n if (entry.digest.isStale) {\r\n existing.staleRuns++;\r\n }\r\n\r\n // Track pending breakpoints. Breakpoint state only changes when explicitly\r\n // approved (which calls invalidateRun), so we always count cached breakpoints\r\n // regardless of cache TTL — the TTL controls when to re-fetch data from disk,\r\n // not whether the data is valid for display. Removing the isCacheValid check\r\n // prevents breakpoint banner flickering when discovery is debounced. (v0.12.3)\r\n if (entry.digest.pendingBreakpoints && entry.digest.pendingBreakpoints > 0 &&\r\n entry.digest.waitingKind === \"breakpoint\") {\r\n existing.pendingBreakpoints += entry.digest.pendingBreakpoints;\r\n existing.breakpointRuns.push({\r\n runId: entry.digest.runId,\r\n effectId: entry.digest.breakpointEffectId || \"\",\r\n projectName,\r\n processId: entry.digest.processId || \"unknown\",\r\n breakpointQuestion: entry.digest.breakpointQuestion || \"Approval required\",\r\n });\r\n }\r\n\r\n // Track latest update\r\n if (!existing.latestUpdate || entry.digest.updatedAt > existing.latestUpdate) {\r\n existing.latestUpdate = entry.digest.updatedAt;\r\n }\r\n\r\n projectMap.set(projectName, existing);\r\n }\r\n\r\n return Array.from(projectMap.entries()).map(([projectName, stats]) => ({\r\n projectName,\r\n ...stats,\r\n }));\r\n}\r\n\r\n// Debounce discovery to avoid scanning filesystem on every poll\r\nlet lastDiscoveryTime = 0;\r\nconst DISCOVERY_DEBOUNCE_MS = 10000; // 10s — reduced from 60s to ensure new runs appear quickly\r\nlet discoveryNeeded = true; // Flag set by watcher when new runs detected\r\n\r\n// Signal that new runs may exist (called by watcher)\r\nexport function requestDiscovery(): void {\r\n discoveryNeeded = true;\r\n}\r\n\r\nexport async function discoverAndCacheAll(): Promise<void> {\r\n const cache = getCache();\r\n const now = Date.now();\r\n\r\n // If cache is populated and no new runs detected, skip expensive filesystem scan\r\n if (cache.size > 0 && !discoveryNeeded && now - lastDiscoveryTime < DISCOVERY_DEBOUNCE_MS) {\r\n return;\r\n }\r\n\r\n lastDiscoveryTime = now;\r\n discoveryNeeded = false;\r\n\r\n const discovered = await discoverAllRunDirs();\r\n\r\n // Deduplicate by run ID (basename) — discoverAllRunDirs already deduplicates\r\n // by run ID preferring directories with run.json, but guard here too in case\r\n // the same run ID somehow appears from different sources.\r\n const seen = new Set<string>();\r\n const unique = discovered.filter((d: DiscoveredRun) => {\r\n const runId = path.basename(d.runDir);\r\n if (seen.has(runId)) return false;\r\n seen.add(runId);\r\n return true;\r\n });\r\n\r\n // Build the set of valid runDir paths from discovery\r\n const validRunDirs = new Set(unique.map((d: DiscoveredRun) => d.runDir));\r\n\r\n // Prune cache entries whose runDir is no longer in the discovered set.\r\n // This removes ghost entries that were cached before dedup was applied\r\n // (e.g. a duplicate run discovered at a different path).\r\n for (const [runDir] of cache) {\r\n if (!validRunDirs.has(runDir)) {\r\n cache.delete(runDir);\r\n }\r\n }\r\n\r\n // Pre-populate cache with digests in batches to avoid overwhelming filesystem\r\n const BATCH_SIZE = 10;\r\n for (let i = 0; i < unique.length; i += BATCH_SIZE) {\r\n const batch = unique.slice(i, i + BATCH_SIZE);\r\n await Promise.all(\r\n batch.map(async (discoveredRun: DiscoveredRun) => {\r\n try {\r\n await getDigestCached(\r\n discoveredRun.runDir,\r\n discoveredRun.source,\r\n discoveredRun.projectName\r\n );\r\n } catch (err) {\r\n console.error(`Failed to cache run ${discoveredRun.runDir}:`, err);\r\n }\r\n })\r\n );\r\n }\r\n}\r\n\r\n// Return all cached digests without filesystem scanning.\r\n// Used by the digest API for fast, non-blocking responses.\r\nexport function getAllCachedDigests(): CachedRunDigest[] {\r\n const cache = getCache();\r\n const digests: CachedRunDigest[] = [];\r\n for (const entry of cache.values()) {\r\n digests.push(entry.digest);\r\n }\r\n return digests;\r\n}\r\n\r\n// Export cache for debugging\r\nexport function getCacheStats() {\r\n const cache = getCache();\r\n return {\r\n size: cache.size,\r\n entries: Array.from(cache.entries()).map(([runDir, entry]) => ({\r\n runDir,\r\n status: entry.digest.status,\r\n cachedAt: entry.cachedAt,\r\n hasFullRun: !!entry.fullRun,\r\n })),\r\n };\r\n}\r\n","/**\n * Typed GlobalRegistry — replaces raw `(globalThis as any).__key` casts with\n * type-safe accessors that persist across HMR reloads.\n *\n * Usage:\n * const cache = getGlobal('__observer_run_cache__', () => new Map<string, CacheEntry>());\n *\n * The first call lazily initialises the value on `globalThis`; subsequent calls\n * (including after HMR) return the existing instance.\n */\n\nimport type { EventEmitter } from \"events\";\nimport type { FSWatcher } from \"fs\";\n\n// ---------------------------------------------------------------------------\n// 1. Declare the shape of every key we store on globalThis.\n// Adding a new key is a compile-time-only change — just extend this map.\n// ---------------------------------------------------------------------------\n\n/**\n * Maps each globalThis key to its concrete runtime type.\n *\n * Every module that needs HMR-safe global state registers its key + type here\n * so the accessor can enforce type safety without `any` casts.\n */\nexport interface GlobalRegistryMap {\n /** run-cache.ts — Map of runDir to CacheEntry */\n __observer_run_cache__: Map<string, unknown>;\n\n /** watcher.ts — shared EventEmitter for watcher change events */\n __observer_watcher_events__: EventEmitter;\n\n /** watcher.ts — active FSWatcher instances + debounce timers */\n __observer_watchers__: {\n activeWatchers: Map<string, FSWatcher>;\n debounceTimers: Map<string, NodeJS.Timeout>;\n rescanTimer: NodeJS.Timeout | null;\n };\n\n /** server-init.ts — shared EventEmitter for SSE server events */\n __observer_server_events__: EventEmitter;\n\n /** server-init.ts — leading-edge debounce state for SSE broadcasts */\n __observer_sse_debounce__: {\n pendingRunDirs: Set<string>;\n timer: ReturnType<typeof setTimeout> | null;\n windowOpen: boolean;\n };\n\n /** server-init.ts — initialization state (singleton guard) */\n __observer_init__: {\n initialized: boolean;\n initPromise: Promise<void> | null;\n cleanup: (() => void) | null;\n };\n}\n\n// ---------------------------------------------------------------------------\n// 2. Augment the global scope so TypeScript knows about our keys.\n// ---------------------------------------------------------------------------\n\ndeclare global {\n // eslint-disable-next-line no-var -- var is required for globalThis augmentation\n var __observer_registry__: Partial<GlobalRegistryMap> | undefined;\n}\n\n// ---------------------------------------------------------------------------\n// 3. Typed accessor — the only public API.\n// ---------------------------------------------------------------------------\n\n/**\n * Return an HMR-safe global value, lazily initialising it via `factory` on\n * first access.\n *\n * The value is stored on `globalThis.__observer_registry__` under the given\n * key so it survives hot-module reloads.\n *\n * @param key One of the keys declared in {@link GlobalRegistryMap}.\n * @param factory Called once to create the initial value if it does not exist.\n * @returns The (possibly pre-existing) value.\n */\nexport function getGlobal<K extends keyof GlobalRegistryMap>(\n key: K,\n factory: () => GlobalRegistryMap[K],\n): GlobalRegistryMap[K] {\n if (!globalThis.__observer_registry__) {\n globalThis.__observer_registry__ = {};\n }\n\n const registry = globalThis.__observer_registry__;\n\n if (registry[key] === undefined) {\n registry[key] = factory();\n }\n\n return registry[key] as GlobalRegistryMap[K];\n}\n\n/**\n * Clear a single key from the global registry.\n *\n * Primarily useful during shutdown / test teardown.\n */\nexport function clearGlobal<K extends keyof GlobalRegistryMap>(key: K): void {\n if (globalThis.__observer_registry__) {\n delete globalThis.__observer_registry__[key];\n }\n}\n\n/**\n * Clear the entire global registry.\n *\n * Primarily useful in tests.\n */\nexport function clearAllGlobals(): void {\n globalThis.__observer_registry__ = undefined;\n}\n","import path from \"path\";\r\nimport { EventEmitter } from \"events\";\r\nimport { initWatcher, watcherEvents, type WatcherEvent } from \"./watcher\";\r\nimport { discoverAndCacheAll } from \"./run-cache\";\r\nimport { getGlobal } from \"./global-registry\";\r\n\r\n// Shared event bus for SSE endpoints — persist across HMR via typed global registry\r\nfunction getServerEvents(): EventEmitter {\r\n return getGlobal('__observer_server_events__', () => new EventEmitter());\r\n}\r\n\r\nexport const serverEvents = getServerEvents();\r\n\r\n// ---------------------------------------------------------------------------\r\n// Leading-edge debounce for SSE broadcasts\r\n// ---------------------------------------------------------------------------\r\n// N clients x M rapid file changes = N*M redundant API requests. This\r\n// debounce fires immediately on the *first* run-changed event (leading edge),\r\n// then collects any subsequent events within a 500ms window and emits a\r\n// single batched notification containing all affected runIds.\r\n// ---------------------------------------------------------------------------\r\n\r\nexport const SSE_DEBOUNCE_MS = 500;\r\n\r\nexport interface BatchedRunChangedEvent {\r\n type: \"run-changed\";\r\n runIds: string[];\r\n runDirs: string[];\r\n}\r\n\r\n// Persist debounce state across HMR reloads via typed global registry\r\ninterface DebounceState {\r\n pendingRunDirs: Set<string>;\r\n timer: ReturnType<typeof setTimeout> | null;\r\n /** True while we are inside a debounce window (leading edge already fired). */\r\n windowOpen: boolean;\r\n}\r\n\r\nfunction getDebounceState(): DebounceState {\r\n return getGlobal('__observer_sse_debounce__', () => ({\r\n pendingRunDirs: new Set<string>(),\r\n timer: null,\r\n windowOpen: false,\r\n }));\r\n}\r\n\r\nexport function resetDebounceState(): void {\r\n const ds = getDebounceState();\r\n if (ds.timer) clearTimeout(ds.timer);\r\n ds.timer = null;\r\n ds.pendingRunDirs.clear();\r\n ds.windowOpen = false;\r\n}\r\n\r\n/** Flush the batch — emit a single event with all collected runIds. */\r\nfunction flushBatch(): void {\r\n const ds = getDebounceState();\r\n const runDirs = Array.from(ds.pendingRunDirs);\r\n ds.pendingRunDirs.clear();\r\n ds.timer = null;\r\n ds.windowOpen = false;\r\n\r\n if (runDirs.length === 0) return;\r\n\r\n const runIds = runDirs.map((d) => path.basename(d));\r\n serverEvents.emit(\"run-changed\", {\r\n type: \"run-changed\",\r\n runIds,\r\n runDirs,\r\n } as BatchedRunChangedEvent);\r\n}\r\n\r\n/**\r\n * Enqueue a run-changed event into the leading-edge debounce.\r\n *\r\n * Behaviour:\r\n * 1. If no window is open, emit immediately (leading edge) and open window.\r\n * 2. If window is already open, collect the runDir and reset the 500ms timer\r\n * (trailing flush).\r\n */\r\nexport function enqueueRunChanged(event: WatcherEvent): void {\r\n const ds = getDebounceState();\r\n\r\n // Note: forceRefreshBreakpointRuns() was previously called here on every\r\n // watcher event, but it deleted ALL breakpoint cache entries globally —\r\n // causing banner flickering during active orchestration. The specific run\r\n // is already invalidated by invalidateRun(runDir) in the watcher handlers,\r\n // so broad cache clearing is unnecessary. (v0.12.3 fix)\r\n\r\n if (!ds.windowOpen) {\r\n // --- Leading edge: fire immediately for this single runDir ---\r\n ds.windowOpen = true;\r\n\r\n const runId = path.basename(event.runDir);\r\n serverEvents.emit(\"run-changed\", {\r\n type: \"run-changed\",\r\n runIds: [runId],\r\n runDirs: [event.runDir],\r\n } as BatchedRunChangedEvent);\r\n\r\n // Open a 500ms collection window for subsequent events\r\n ds.timer = setTimeout(flushBatch, SSE_DEBOUNCE_MS);\r\n } else {\r\n // --- Inside window: collect and reset timer ---\r\n ds.pendingRunDirs.add(event.runDir);\r\n\r\n // Reset the trailing-edge timer so the window extends on each new event\r\n if (ds.timer) clearTimeout(ds.timer);\r\n ds.timer = setTimeout(flushBatch, SSE_DEBOUNCE_MS);\r\n }\r\n}\r\n\r\n// Persist initialization state across HMR reloads via typed global registry\r\ninterface InitState {\r\n initialized: boolean;\r\n initPromise: Promise<void> | null;\r\n cleanup: (() => void) | null;\r\n}\r\n\r\nfunction getInitState(): InitState {\r\n return getGlobal('__observer_init__', () => ({\r\n initialized: false,\r\n initPromise: null,\r\n cleanup: null,\r\n }));\r\n}\r\n\r\nexport async function ensureInitialized(): Promise<void> {\r\n const state = getInitState();\r\n\r\n // Already initialized\r\n if (state.initialized) {\r\n return;\r\n }\r\n\r\n // Initialization in progress\r\n if (state.initPromise) {\r\n return state.initPromise;\r\n }\r\n\r\n // Start initialization\r\n state.initPromise = (async () => {\r\n try {\r\n console.log(\"Starting server initialization...\");\r\n\r\n // Step 1: Initialize watcher\r\n console.log(\"Setting up filesystem watcher...\");\r\n state.cleanup = await initWatcher();\r\n\r\n // Step 2: Initial cache population\r\n console.log(\"Populating cache with discovered runs...\");\r\n await discoverAndCacheAll();\r\n\r\n // Step 3: Listen to watcher events and broadcast via leading-edge debounce\r\n // Watcher already invalidates the specific run cache in handleJournalChange.\r\n // Additionally, when a journal change is detected, force-refresh all breakpoint\r\n // cache entries. This ensures that EFFECT_RESOLVED events for breakpoints\r\n // immediately clear stale breakpoint data across all cached runs — not just\r\n // the specific run that changed.\r\n //\r\n // run-changed events are routed through enqueueRunChanged() which implements\r\n // a 500ms leading-edge debounce: the first event fires immediately, then\r\n // subsequent events within the window are batched and flushed once.\r\n\r\n // Dedup window for transient watcher errors — suppress duplicates within 5s\r\n // to prevent cascading SSE error events that trigger client-side flash\r\n let lastWatcherErrorTime = 0;\r\n const WATCHER_ERROR_DEDUP_MS = 5000;\r\n\r\n watcherEvents.on(\"change\", (event: WatcherEvent) => {\r\n if (event.type === \"run-changed\") {\r\n enqueueRunChanged(event);\r\n } else if (event.type === \"new-run\") {\r\n serverEvents.emit(\"new-run\", event);\r\n } else if (event.type === \"error\") {\r\n // Suppress transient watcher errors within dedup window\r\n const now = Date.now();\r\n if (now - lastWatcherErrorTime >= WATCHER_ERROR_DEDUP_MS) {\r\n lastWatcherErrorTime = now;\r\n serverEvents.emit(\"watcher-error\", event);\r\n }\r\n }\r\n });\r\n\r\n state.initialized = true;\r\n console.log(\"Server initialization complete\");\r\n } catch (err) {\r\n console.error(\"Server initialization failed:\", err);\r\n state.initPromise = null;\r\n throw err;\r\n }\r\n })();\r\n\r\n return state.initPromise;\r\n}\r\n\r\n// Cleanup function for graceful shutdown\r\nexport async function shutdownServer(): Promise<void> {\r\n const state = getInitState();\r\n\r\n if (state.cleanup) {\r\n state.cleanup();\r\n state.cleanup = null;\r\n }\r\n\r\n state.initialized = false;\r\n state.initPromise = null;\r\n\r\n // Clear SSE debounce timers\r\n resetDebounceState();\r\n\r\n // Remove all event listeners\r\n serverEvents.removeAllListeners();\r\n\r\n console.log(\"Server shutdown complete\");\r\n}\r\n\r\n// Get initialization status for debugging\r\nexport function getInitStatus() {\r\n const state = getInitState();\r\n return {\r\n initialized: state.initialized,\r\n hasCleanup: !!state.cleanup,\r\n serverEventListeners: serverEvents.eventNames().length,\r\n };\r\n}\r\n","import { watch, type FSWatcher } from \"fs\";\r\nimport { promises as fs } from \"fs\";\r\nimport path from \"path\";\r\nimport { EventEmitter } from \"events\";\r\nimport { discoverAllRunDirs, invalidateDiscoveryCache, discoverAllRunsParentDirs } from \"./source-discovery\";\r\nimport { invalidateRun, requestDiscovery } from \"./run-cache\";\r\nimport { getGlobal } from \"./global-registry\";\r\n\r\n// Persist event emitter across HMR reloads via typed global registry\r\nfunction getWatcherEvents(): EventEmitter {\r\n return getGlobal('__observer_watcher_events__', () => new EventEmitter());\r\n}\r\n\r\nexport const watcherEvents = getWatcherEvents();\r\n\r\n// Event types\r\nexport type WatcherEventType = \"run-changed\" | \"new-run\" | \"error\";\r\n\r\nexport interface WatcherEvent {\r\n type: WatcherEventType;\r\n runDir: string;\r\n error?: Error;\r\n}\r\n\r\n// Persist watcher state across HMR reloads via typed global registry\r\ninterface WatcherState {\r\n activeWatchers: Map<string, FSWatcher>;\r\n debounceTimers: Map<string, NodeJS.Timeout>;\r\n rescanTimer: NodeJS.Timeout | null;\r\n}\r\n\r\nfunction getWatcherState(): WatcherState {\r\n return getGlobal('__observer_watchers__', () => ({\r\n activeWatchers: new Map<string, FSWatcher>(),\r\n debounceTimers: new Map<string, NodeJS.Timeout>(),\r\n rescanTimer: null,\r\n }));\r\n}\r\n\r\n// WSL-optimized constants\r\nconst DEBOUNCE_MS = 500; // 500ms debounce (WSL cross-FS needs more)\r\nconst RESCAN_INTERVAL_MS = 30000; // 30s — reduced from 120s to detect new project directories faster\r\n\r\nfunction debounceChange(runDir: string, callback: () => void) {\r\n const state = getWatcherState();\r\n const existing = state.debounceTimers.get(runDir);\r\n if (existing) {\r\n clearTimeout(existing);\r\n }\r\n\r\n const timer = setTimeout(() => {\r\n state.debounceTimers.delete(runDir);\r\n callback();\r\n }, DEBOUNCE_MS);\r\n\r\n state.debounceTimers.set(runDir, timer);\r\n}\r\n\r\nfunction handleJournalChange(journalDir: string) {\r\n const runDir = path.dirname(journalDir);\r\n\r\n debounceChange(runDir, () => {\r\n invalidateRun(runDir);\r\n requestDiscovery(); // Ensure discoverAndCacheAll() re-populates the entry\r\n watcherEvents.emit(\"change\", {\r\n type: \"run-changed\",\r\n runDir,\r\n } as WatcherEvent);\r\n });\r\n}\r\n\r\nfunction handleTasksChange(tasksDir: string) {\r\n const runDir = path.dirname(tasksDir);\r\n\r\n debounceChange(runDir, () => {\r\n invalidateRun(runDir);\r\n requestDiscovery(); // Ensure discoverAndCacheAll() re-populates the entry\r\n watcherEvents.emit(\"change\", {\r\n type: \"run-changed\",\r\n runDir,\r\n } as WatcherEvent);\r\n });\r\n}\r\n\r\nfunction handleRunsParentChange(runsDir: string) {\r\n debounceChange(runsDir, () => {\r\n // Invalidate caches so new runs are picked up on next request\r\n invalidateDiscoveryCache();\r\n requestDiscovery();\r\n watcherEvents.emit(\"change\", {\r\n type: \"new-run\",\r\n runDir: runsDir,\r\n } as WatcherEvent);\r\n });\r\n}\r\n\r\nfunction watchDirectory(dirPath: string, onChange: (path: string) => void): FSWatcher | null {\r\n try {\r\n // Use non-recursive watch (WSL doesn't support recursive)\r\n const watcher = watch(dirPath, { recursive: false }, (eventType, filename) => {\r\n if (filename) {\r\n onChange(dirPath);\r\n }\r\n });\r\n\r\n watcher.on(\"error\", (err) => {\r\n console.error(`Watch error for ${dirPath}:`, err);\r\n watcherEvents.emit(\"change\", {\r\n type: \"error\",\r\n runDir: dirPath,\r\n error: err,\r\n } as WatcherEvent);\r\n });\r\n\r\n return watcher;\r\n } catch (err) {\r\n console.error(`Failed to watch ${dirPath}:`, err);\r\n return null;\r\n }\r\n}\r\n\r\nasync function setupWatchers() {\r\n const state = getWatcherState();\r\n const discovered = await discoverAllRunDirs();\r\n const runsParentDirs = new Set<string>();\r\n\r\n // Build the set of directories we need to watch\r\n const neededDirs = new Set<string>();\r\n\r\n for (const { runDir } of discovered) {\r\n const journalDir = path.join(runDir, \"journal\");\r\n try {\r\n await fs.access(journalDir);\r\n neededDirs.add(journalDir);\r\n } catch {\r\n // Journal dir doesn't exist yet — skip for now\r\n }\r\n\r\n const tasksDir = path.join(runDir, \"tasks\");\r\n try {\r\n await fs.access(tasksDir);\r\n neededDirs.add(tasksDir);\r\n } catch {\r\n // Tasks dir doesn't exist yet — skip for now\r\n }\r\n\r\n const runsDir = path.dirname(runDir);\r\n runsParentDirs.add(runsDir);\r\n }\r\n\r\n // Also discover ALL .a5c/runs/ directories (including empty ones)\r\n // so we detect the very first run in a new project immediately\r\n try {\r\n const allRunsParentDirs = await discoverAllRunsParentDirs();\r\n for (const dir of allRunsParentDirs) {\r\n runsParentDirs.add(dir);\r\n }\r\n } catch {\r\n // Non-critical — fall back to watching only populated runs dirs\r\n }\r\n\r\n for (const runsDir of runsParentDirs) {\r\n try {\r\n await fs.access(runsDir);\r\n neededDirs.add(runsDir);\r\n } catch {\r\n // Runs dir doesn't exist\r\n }\r\n }\r\n\r\n // Incremental update: close watchers for directories no longer needed\r\n for (const [dirPath, watcher] of state.activeWatchers.entries()) {\r\n if (!neededDirs.has(dirPath)) {\r\n watcher.close();\r\n state.activeWatchers.delete(dirPath);\r\n }\r\n }\r\n\r\n // Only create new watchers for newly discovered directories\r\n for (const dirPath of neededDirs) {\r\n if (!state.activeWatchers.has(dirPath)) {\r\n const baseName = path.basename(dirPath);\r\n const isJournalDir = baseName === \"journal\";\r\n const isTasksDir = baseName === \"tasks\";\r\n const onChange = isJournalDir\r\n ? handleJournalChange\r\n : isTasksDir\r\n ? handleTasksChange\r\n : handleRunsParentChange;\r\n const watcher = watchDirectory(dirPath, onChange);\r\n if (watcher) {\r\n state.activeWatchers.set(dirPath, watcher);\r\n }\r\n }\r\n }\r\n\r\n console.log(`Watching ${state.activeWatchers.size} directories`);\r\n}\r\n\r\nasync function periodicRescan() {\r\n try {\r\n // Re-discover and update watchers incrementally\r\n await setupWatchers();\r\n } catch (err) {\r\n console.error(\"Periodic rescan failed:\", err);\r\n }\r\n}\r\n\r\nexport async function initWatcher(): Promise<() => void> {\r\n const state = getWatcherState();\r\n\r\n // If watchers already exist from a previous HMR cycle, skip full re-init\r\n if (state.activeWatchers.size > 0) {\r\n console.log(`Reusing ${state.activeWatchers.size} existing watchers (HMR-safe)`);\r\n // Still do an incremental rescan to pick up any new directories\r\n await setupWatchers();\r\n } else {\r\n console.log(\"Initializing filesystem watcher...\");\r\n await setupWatchers();\r\n }\r\n\r\n // Clear any existing rescan timer before setting a new one\r\n if (state.rescanTimer) {\r\n clearInterval(state.rescanTimer);\r\n }\r\n\r\n // Schedule periodic rescans\r\n state.rescanTimer = setInterval(periodicRescan, RESCAN_INTERVAL_MS);\r\n\r\n // Return cleanup function\r\n return () => {\r\n console.log(\"Cleaning up filesystem watcher...\");\r\n\r\n // Clear rescan timer\r\n if (state.rescanTimer) {\r\n clearInterval(state.rescanTimer);\r\n state.rescanTimer = null;\r\n }\r\n\r\n // Clear debounce timers\r\n for (const timer of state.debounceTimers.values()) {\r\n clearTimeout(timer);\r\n }\r\n state.debounceTimers.clear();\r\n\r\n // Close all watchers\r\n for (const watcher of state.activeWatchers.values()) {\r\n watcher.close();\r\n }\r\n state.activeWatchers.clear();\r\n\r\n // Remove all event listeners\r\n watcherEvents.removeAllListeners();\r\n };\r\n}\r\n\r\n// Get watcher stats for debugging\r\nexport function getWatcherStats() {\r\n const state = getWatcherState();\r\n return {\r\n activeWatchers: state.activeWatchers.size,\r\n watchedPaths: Array.from(state.activeWatchers.keys()),\r\n pendingDebounces: state.debounceTimers.size,\r\n };\r\n}\r\n"],"names":["getGlobal","key","factory","globalThis","__observer_registry__","registry","undefined","clearGlobal","clearAllGlobals","getWatcherEvents","watcherEvents","getWatcherState","activeWatchers","Map","debounceTimers","rescanTimer","DEBOUNCE_MS","RESCAN_INTERVAL_MS","debounceChange","runDir","callback","state","existing","get","clearTimeout","timer","setTimeout","delete","set","handleJournalChange","journalDir","dirname","emit","type","handleTasksChange","tasksDir","handleRunsParentChange","runsDir","watchDirectory","dirPath","onChange","watcher","recursive","eventType","filename","on","err","console","error","setupWatchers","discovered","runsParentDirs","Set","neededDirs","join","access","add","allRunsParentDirs","dir","entries","has","close","baseName","basename","isJournalDir","isTasksDir","log","size","periodicRescan","initWatcher","clearInterval","setInterval","values","clear","removeAllListeners","getWatcherStats","watchedPaths","Array","from","keys","pendingDebounces"],"mappings":"k3BAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEA,EAAA,EAAA,CAAA,CAAA,OAGA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OC2EO,SAASA,EACdC,CAAM,CACNC,CAAmC,EAE/B,AAACC,WAAWC,qBAAqB,EAAE,CACrCD,WAAWC,qBAAqB,CAAG,EAAC,EAGtC,IAAMC,EAAWF,WAAWC,qBAAqB,CAMjD,YAJsBE,IAAlBD,CAAQ,CAACJ,EAAI,GAAgB,AAC/BI,CAAQ,CAACJ,EAAI,CAAGC,GAAAA,EAGXG,CAAQ,CAACJ,EAAI,AACtB,CD/DA,SAAS,IACP,OAAO,EAAU,yBAA0B,IAAM,IAAI,IACvD,CAaA,SAAS,EAAO,CAA2B,EACzC,MAAkB,YAAX,GAAmC,YAAX,AAAuB,EAPrC,IADG,EACG,CAQzB,CAEA,GAHqE,AARxC,MAWpB,EAAa,CAAiB,EACrC,IAAM,EAAM,KAAK,GAAG,AAZgC,GAa9C,EAAM,EAAO,EAAM,AAZ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