vibepulse 0.1.12 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +8 -0
- package/.next/build-manifest.json +2 -2
- package/.next/cache/.previewinfo +1 -1
- package/.next/cache/.rscinfo +1 -1
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +56 -0
- package/.next/server/app/_global-error/page.js +1 -1
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/node/events/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/node/events/route/build-manifest.json +11 -0
- package/.next/server/app/api/node/events/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/node/events/route.js +7 -0
- package/.next/server/app/api/node/events/route.js.map +5 -0
- package/.next/server/app/api/node/events/route.js.nft.json +1 -0
- package/.next/server/app/api/node/events/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/node/health/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/node/health/route/build-manifest.json +11 -0
- package/.next/server/app/api/node/health/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/node/health/route.js +6 -0
- package/.next/server/app/api/node/health/route.js.map +5 -0
- package/.next/server/app/api/node/health/route.js.nft.json +1 -0
- package/.next/server/app/api/node/health/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/node/sessions/[id]/archive/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/node/sessions/[id]/archive/route/build-manifest.json +11 -0
- package/.next/server/app/api/node/sessions/[id]/archive/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/node/sessions/[id]/archive/route.js +6 -0
- package/.next/server/app/api/node/sessions/[id]/archive/route.js.map +5 -0
- package/.next/server/app/api/node/sessions/[id]/archive/route.js.nft.json +1 -0
- package/.next/server/app/api/node/sessions/[id]/archive/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/node/sessions/[id]/delete/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/node/sessions/[id]/delete/route/build-manifest.json +11 -0
- package/.next/server/app/api/node/sessions/[id]/delete/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/node/sessions/[id]/delete/route.js +7 -0
- package/.next/server/app/api/node/sessions/[id]/delete/route.js.map +5 -0
- package/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -0
- package/.next/server/app/api/node/sessions/[id]/delete/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/node/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/node/sessions/[id]/open-editor/route/build-manifest.json +11 -0
- package/.next/server/app/api/node/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/node/sessions/[id]/open-editor/route.js +7 -0
- package/.next/server/app/api/node/sessions/[id]/open-editor/route.js.map +5 -0
- package/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -0
- package/.next/server/app/api/node/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/node/sessions/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/node/sessions/route/build-manifest.json +11 -0
- package/.next/server/app/api/node/sessions/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/node/sessions/route.js +9 -0
- package/.next/server/app/api/node/sessions/route.js.map +5 -0
- package/.next/server/app/api/node/sessions/route.js.nft.json +1 -0
- package/.next/server/app/api/node/sessions/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/nodes/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/nodes/route/build-manifest.json +11 -0
- package/.next/server/app/api/nodes/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/nodes/route.js +8 -0
- package/.next/server/app/api/nodes/route.js.map +5 -0
- package/.next/server/app/api/nodes/route.js.nft.json +1 -0
- package/.next/server/app/api/nodes/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/opencode-config/route.js +1 -1
- package/.next/server/app/api/opencode-config/route.js.nft.json +1 -1
- package/.next/server/app/api/opencode-config/status/route.js +1 -1
- package/.next/server/app/api/opencode-config/status/route.js.nft.json +1 -1
- package/.next/server/app/api/opencode-events/route.js +4 -2
- package/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/[id]/apply/route.js +1 -1
- package/.next/server/app/api/profiles/[id]/apply/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/[id]/export/route.js +2 -2
- package/.next/server/app/api/profiles/[id]/export/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/[id]/route.js +2 -2
- package/.next/server/app/api/profiles/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/import/route.js +2 -2
- package/.next/server/app/api/profiles/import/route.js.nft.json +1 -1
- package/.next/server/app/api/profiles/route.js +2 -2
- package/.next/server/app/api/profiles/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/archive/route.js +2 -1
- package/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/delete/route.js +3 -2
- package/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/sessions/[id]/open-editor/route/build-manifest.json +11 -0
- package/.next/server/app/api/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/sessions/[id]/open-editor/route.js +7 -0
- package/.next/server/app/api/sessions/[id]/open-editor/route.js.map +5 -0
- package/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js +3 -3
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +8 -0
- package/.next/server/chunks/{[root-of-the-server]__172a07b6._.js → [externals]_next_dist_84e7390b._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1211da38._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1211da38._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__192ed2f4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__192ed2f4._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__1b87ec42._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1b87ec42._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__2f981540._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__2f981540._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__3745b314._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__3745b314._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__56690af0._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__56690af0._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__56f5f249._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__56f5f249._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__59175de4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__59175de4._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__64fffc02._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__64fffc02._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__6c428a24._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__6c428a24._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__73a00b88._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__73a00b88._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__7e757f50._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__7e757f50._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__b796d06c._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__b796d06c._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__d8e61048._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__d8e61048._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__db285678._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__db285678._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__e00a9200._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__e00a9200._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_events_route_actions_f1abd32d.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_events_route_actions_f1abd32d.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_health_route_actions_c4c4c077.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_health_route_actions_c4c4c077.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_sessions_route_actions_6b564c5a.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_node_sessions_route_actions_6b564c5a.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_nodes_route_actions_3e496ee8.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_nodes_route_actions_3e496ee8.js.map +1 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js.map +1 -0
- package/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js +3 -0
- package/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js.map +1 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js.map +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js +3 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js.map +1 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js.map +1 -1
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +5 -0
- package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js.map +1 -0
- package/.next/{standalone/.next/server/chunks/ssr/[root-of-the-server]__39eef6a5._.js → server/chunks/ssr/[root-of-the-server]__631e12d0._.js} +2 -2
- package/.next/{standalone/.next/server/chunks/ssr/[root-of-the-server]__535a2208._.js → server/chunks/ssr/[root-of-the-server]__a8cd3911._.js} +2 -2
- package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
- package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +8 -0
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/routes-manifest.json +56 -0
- package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/node/events/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/node/events/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/node/events/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/node/events/route.js +7 -0
- package/.next/standalone/.next/server/app/api/node/events/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/node/events/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/node/events/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/node/health/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/node/health/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/node/health/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/node/health/route.js +6 -0
- package/.next/standalone/.next/server/app/api/node/health/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/node/health/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/node/health/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js +6 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js +7 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js +7 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/node/sessions/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/node/sessions/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/node/sessions/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/node/sessions/route.js +9 -0
- package/.next/standalone/.next/server/app/api/node/sessions/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/node/sessions/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/node/sessions/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/nodes/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/nodes/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/nodes/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/nodes/route.js +8 -0
- package/.next/standalone/.next/server/app/api/nodes/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/nodes/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/nodes/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/opencode-config/route.js +1 -1
- package/.next/standalone/.next/server/app/api/opencode-config/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/opencode-config/status/route.js +1 -1
- package/.next/standalone/.next/server/app/api/opencode-config/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/opencode-events/route.js +4 -2
- package/.next/standalone/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/[id]/apply/route.js +1 -1
- package/.next/standalone/.next/server/app/api/profiles/[id]/apply/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/[id]/export/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/[id]/export/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/[id]/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/import/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/import/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/profiles/route.js +2 -2
- package/.next/standalone/.next/server/app/api/profiles/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js +2 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js +3 -2
- package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js +7 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route.js +3 -3
- package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/standalone/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page.js +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +8 -0
- package/.next/standalone/.next/server/chunks/{[root-of-the-server]__172a07b6._.js → [externals]_next_dist_84e7390b._.js} +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1211da38._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__192ed2f4._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1b87ec42._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f981540._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__3745b314._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__56690af0._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__56f5f249._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__59175de4._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__64fffc02._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c428a24._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__73a00b88._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__7e757f50._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__b796d06c._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__d8e61048._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__db285678._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e00a9200._.js +5 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_events_route_actions_f1abd32d.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_health_route_actions_c4c4c077.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_route_actions_6b564c5a.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_nodes_route_actions_3e496ee8.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js +3 -0
- package/.next/standalone/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_aca45402.js +3 -0
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +5 -0
- package/.next/{server/chunks/ssr/[root-of-the-server]__39eef6a5._.js → standalone/.next/server/chunks/ssr/[root-of-the-server]__631e12d0._.js} +2 -2
- package/.next/{server/chunks/ssr/[root-of-the-server]__535a2208._.js → standalone/.next/server/chunks/ssr/[root-of-the-server]__a8cd3911._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +2 -2
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/7ac19aaef01f4a03.js +13 -0
- package/.next/standalone/.next/static/chunks/f42202943f6742e5.css +3 -0
- package/.next/standalone/AGENTS.md +85 -0
- package/.next/standalone/README.md +76 -0
- package/.next/standalone/__mocks__/child_process.ts +4 -0
- package/.next/standalone/bin/dev-runtime.js +58 -0
- package/.next/standalone/bin/vibepulse.js +87 -0
- package/.next/standalone/check-hsql.mjs +71 -0
- package/.next/standalone/docs/session-status-detection.md +258 -0
- package/.next/standalone/eslint.config.mjs +31 -0
- package/.next/standalone/next.config.ts +8 -0
- package/.next/standalone/package-lock.json +10312 -0
- package/.next/standalone/package.json +4 -2
- package/.next/standalone/postcss.config.mjs +7 -0
- package/.next/standalone/public/readme-cover.png +0 -0
- package/.next/standalone/src/AGENTS.md +41 -0
- package/.next/standalone/src/app/api/AGENTS.md +40 -0
- package/.next/standalone/src/app/api/node/events/route.test.ts +196 -0
- package/.next/standalone/src/app/api/node/events/route.ts +259 -0
- package/.next/standalone/src/app/api/node/health/route.test.ts +190 -0
- package/.next/standalone/src/app/api/node/health/route.ts +48 -0
- package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.test.ts +128 -0
- package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.ts +97 -0
- package/.next/standalone/src/app/api/node/sessions/[id]/delete/route.test.ts +113 -0
- package/.next/standalone/src/app/api/node/sessions/[id]/delete/route.ts +81 -0
- package/.next/standalone/src/app/api/node/sessions/[id]/open-editor/route.test.ts +206 -0
- package/.next/standalone/src/app/api/node/sessions/[id]/open-editor/route.ts +123 -0
- package/.next/standalone/src/app/api/node/sessions/route.test.ts +408 -0
- package/.next/standalone/src/app/api/node/sessions/route.ts +1094 -0
- package/.next/standalone/src/app/api/nodes/route.test.ts +237 -0
- package/.next/standalone/src/app/api/nodes/route.ts +176 -0
- package/.next/standalone/src/app/api/opencode-config/route.test.ts +86 -0
- package/.next/standalone/src/app/api/opencode-config/route.ts +376 -0
- package/.next/standalone/src/app/api/opencode-config/status/route.ts +31 -0
- package/.next/standalone/src/app/api/opencode-events/route.test.ts +624 -0
- package/.next/standalone/src/app/api/opencode-events/route.ts +508 -0
- package/.next/standalone/src/app/api/opencode-models/route.test.ts +167 -0
- package/.next/standalone/src/app/api/opencode-models/route.ts +76 -0
- package/.next/standalone/src/app/api/profiles/[id]/apply/route.ts +49 -0
- package/.next/standalone/src/app/api/profiles/[id]/export/route.ts +31 -0
- package/.next/standalone/src/app/api/profiles/[id]/route.ts +160 -0
- package/.next/standalone/src/app/api/profiles/import/route.test.js +107 -0
- package/.next/standalone/src/app/api/profiles/import/route.ts +65 -0
- package/.next/standalone/src/app/api/profiles/route.ts +107 -0
- package/.next/standalone/src/app/api/sessions/[id]/archive/route.test.ts +136 -0
- package/.next/standalone/src/app/api/sessions/[id]/archive/route.ts +170 -0
- package/.next/standalone/src/app/api/sessions/[id]/delete/route.test.ts +113 -0
- package/.next/standalone/src/app/api/sessions/[id]/delete/route.ts +137 -0
- package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.test.ts +218 -0
- package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.ts +85 -0
- package/.next/standalone/src/app/api/sessions/[id]/route.test.ts +531 -0
- package/.next/standalone/src/app/api/sessions/[id]/route.ts +75 -0
- package/.next/standalone/src/app/api/sessions/route.test.ts +1298 -0
- package/.next/standalone/src/app/api/sessions/route.ts +1695 -0
- package/.next/standalone/src/app/favicon.ico +0 -0
- package/.next/standalone/src/app/globals.css +66 -0
- package/.next/standalone/src/app/layout.tsx +37 -0
- package/.next/standalone/src/app/page.test.tsx +134 -0
- package/.next/standalone/src/app/page.tsx +358 -0
- package/.next/standalone/src/components/AGENTS.md +42 -0
- package/.next/standalone/src/components/ErrorBoundary.tsx +72 -0
- package/.next/standalone/src/components/KanbanBoard.test.tsx +704 -0
- package/.next/standalone/src/components/KanbanBoard.tsx +852 -0
- package/.next/standalone/src/components/LoadingState.tsx +37 -0
- package/.next/standalone/src/components/ProjectCard.test.tsx +773 -0
- package/.next/standalone/src/components/ProjectCard.tsx +595 -0
- package/.next/standalone/src/components/QueryProvider.tsx +25 -0
- package/.next/standalone/src/components/SessionCard.test.tsx +566 -0
- package/.next/standalone/src/components/SessionCard.tsx +434 -0
- package/.next/standalone/src/components/SessionList.tsx +60 -0
- package/.next/standalone/src/components/host-config/HostManagerDialog.test.tsx +252 -0
- package/.next/standalone/src/components/host-config/HostManagerDialog.tsx +476 -0
- package/.next/standalone/src/components/opencode-config/AgentConfigForm.test.tsx +72 -0
- package/.next/standalone/src/components/opencode-config/AgentConfigForm.tsx +483 -0
- package/.next/standalone/src/components/opencode-config/AgentModelSelector.tsx +284 -0
- package/.next/standalone/src/components/opencode-config/AgentsConfigPanel.tsx +162 -0
- package/.next/standalone/src/components/opencode-config/ConfigButton.tsx +43 -0
- package/.next/standalone/src/components/opencode-config/ConfigPanel.tsx +91 -0
- package/.next/standalone/src/components/opencode-config/FullscreenConfigPanel.tsx +435 -0
- package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.test.tsx +91 -0
- package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.tsx +288 -0
- package/.next/standalone/src/components/opencode-config/categories/CategoriesList.tsx +382 -0
- package/.next/standalone/src/components/opencode-config/categories/CategoriesManager.test.tsx +111 -0
- package/.next/standalone/src/components/opencode-config/categories/CategoriesManager.tsx +174 -0
- package/.next/standalone/src/components/opencode-config/categories/CategoryConfigForm.tsx +453 -0
- package/.next/standalone/src/components/opencode-config/profiles/ProfileCard.tsx +140 -0
- package/.next/standalone/src/components/opencode-config/profiles/ProfileEditor.tsx +446 -0
- package/.next/standalone/src/components/opencode-config/profiles/ProfileList.tsx +446 -0
- package/.next/standalone/src/components/opencode-config/profiles/ProfileManager.test.tsx +225 -0
- package/.next/standalone/src/components/opencode-config/profiles/ProfileManager.tsx +405 -0
- package/.next/standalone/src/components/ui/Tabs.tsx +59 -0
- package/.next/standalone/src/hooks/useHostSources.test.ts +509 -0
- package/.next/standalone/src/hooks/useHostSources.ts +299 -0
- package/.next/standalone/src/hooks/useOpencodeSync.test.ts +387 -0
- package/.next/standalone/src/hooks/useOpencodeSync.ts +571 -0
- package/.next/standalone/src/index.ts +2 -0
- package/.next/standalone/src/lib/editorLauncher.server.ts +36 -0
- package/.next/standalone/src/lib/editorLauncher.test.ts +35 -0
- package/.next/standalone/src/lib/editorLauncher.ts +25 -0
- package/.next/standalone/src/lib/hostAccent.test.ts +58 -0
- package/.next/standalone/src/lib/hostAccent.ts +46 -0
- package/.next/standalone/src/lib/hostIdentity.test.ts +187 -0
- package/.next/standalone/src/lib/hostIdentity.ts +122 -0
- package/.next/standalone/src/lib/hostSourcesStorage.test.ts +141 -0
- package/.next/standalone/src/lib/hostSourcesStorage.ts +72 -0
- package/.next/standalone/src/lib/nodeProtocol.test.ts +159 -0
- package/.next/standalone/src/lib/nodeProtocol.ts +142 -0
- package/.next/standalone/src/lib/nodeRegistry.test.ts +173 -0
- package/.next/standalone/src/lib/nodeRegistry.ts +398 -0
- package/.next/standalone/src/lib/notificationSound.ts +292 -0
- package/.next/standalone/src/lib/opencodeConfig.test.ts +100 -0
- package/.next/standalone/src/lib/opencodeConfig.ts +76 -0
- package/.next/standalone/src/lib/opencodeDiscovery.ts +275 -0
- package/.next/standalone/src/lib/profiles/share.test.ts +91 -0
- package/.next/standalone/src/lib/profiles/share.ts +93 -0
- package/.next/standalone/src/lib/profiles/storage.test.ts +108 -0
- package/.next/standalone/src/lib/profiles/storage.ts +370 -0
- package/.next/standalone/src/lib/runtimeMode.test.ts +29 -0
- package/.next/standalone/src/lib/runtimeMode.ts +29 -0
- package/.next/standalone/src/lib/sessionActionErrors.ts +37 -0
- package/.next/standalone/src/lib/sessionArchiveOverrides.test.ts +43 -0
- package/.next/standalone/src/lib/sessionArchiveOverrides.ts +116 -0
- package/.next/standalone/src/lib/transform.test.ts +121 -0
- package/.next/standalone/src/lib/transform.ts +193 -0
- package/.next/standalone/src/test/setup.ts +8 -0
- package/.next/standalone/src/types/index.ts +152 -0
- package/.next/standalone/src/types/opencodeConfig.ts +149 -0
- package/.next/standalone/tsconfig.json +34 -0
- package/.next/standalone/tsconfig.lib.json +17 -0
- package/.next/standalone/vitest.config.ts +16 -0
- package/.next/static/chunks/7ac19aaef01f4a03.js +13 -0
- package/.next/static/chunks/f42202943f6742e5.css +3 -0
- package/.next/trace +1 -1
- package/.next/trace-build +1 -1
- package/.next/types/routes.d.ts +9 -1
- package/.next/types/validator.ts +72 -0
- package/README.md +28 -11
- package/bin/dev-runtime.js +58 -0
- package/bin/vibepulse.js +72 -39
- package/package.json +4 -2
- package/public/readme-cover.png +0 -0
- package/.next/server/chunks/[externals]_next_dist_16542d6b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__07488412._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__07488412._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__07649a30._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__07649a30._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__172a07b6._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__1bf88ae0._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1bf88ae0._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__2c3e3de2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__2c3e3de2._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__560e7c61._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__560e7c61._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__9f034d03._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__9f034d03._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__a84faf4b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__a84faf4b._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__b92251ea._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__b92251ea._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__e7a766a0._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__e7a766a0._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__f234882e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__f234882e._.js.map +0 -1
- package/.next/server/chunks/[root-of-the-server]__f85221b8._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__f85221b8._.js.map +0 -1
- package/.next/standalone/.next/server/chunks/[externals]_next_dist_16542d6b._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__07488412._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__07649a30._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1bf88ae0._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__2c3e3de2._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__560e7c61._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__9f034d03._.js +0 -5
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__a84faf4b._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__b92251ea._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e7a766a0._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__f234882e._.js +0 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__f85221b8._.js +0 -3
- package/.next/standalone/.next/static/chunks/ca49cb2092c277d2.js +0 -13
- package/.next/standalone/.next/static/chunks/dc07499869593595.css +0 -3
- package/.next/static/chunks/ca49cb2092c277d2.js +0 -13
- package/.next/static/chunks/dc07499869593595.css +0 -3
- /package/.next/server/chunks/{[externals]_next_dist_16542d6b._.js.map → [externals]_next_dist_84e7390b._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{[root-of-the-server]__39eef6a5._.js.map → [root-of-the-server]__631e12d0._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{[root-of-the-server]__535a2208._.js.map → [root-of-the-server]__a8cd3911._.js.map} +0 -0
- /package/.next/standalone/.next/static/{78EwnRx2m70qyfCL0X4sH → Fw2R3y-fHX4B2SWxNy_4X}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{78EwnRx2m70qyfCL0X4sH → Fw2R3y-fHX4B2SWxNy_4X}/_clientMiddlewareManifest.json +0 -0
- /package/.next/standalone/.next/static/{78EwnRx2m70qyfCL0X4sH → Fw2R3y-fHX4B2SWxNy_4X}/_ssgManifest.js +0 -0
- /package/.next/static/{78EwnRx2m70qyfCL0X4sH → Fw2R3y-fHX4B2SWxNy_4X}/_buildManifest.js +0 -0
- /package/.next/static/{78EwnRx2m70qyfCL0X4sH → Fw2R3y-fHX4B2SWxNy_4X}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{78EwnRx2m70qyfCL0X4sH → Fw2R3y-fHX4B2SWxNy_4X}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[81951,e=>{"use strict";e.s(["RUNTIME_ROLE_ENV_VAR",0,"VIBEPULSE_RUNTIME_ROLE"])},68817,e=>{"use strict";var t=e.i(81951);let r="x-vibepulse-node-version",n={unauthorized:401,unsupported_node_version:426,node_misconfigured:503,upstream_unreachable:503,upstream_timeout:504};function o(e){return"string"!=typeof e?null:e.trim()||null}function s(e,t){let n=new Headers(t);n.set(r,"1");let s=o(e??null);return s&&n.set("authorization",`Bearer ${s}`),n}function i(e,t){return{ok:!1,reason:e,protocolVersion:"1",..."node_misconfigured"===e||"upstream_unreachable"===e||"upstream_timeout"===e?{degraded:!0}:{},...t??{}}}function a(e,t){return Response.json(i(e,t),{status:n[e]})}function u(e){return Response.json(e.body,{status:e.status})}function l(e,s={}){if("node"!==(s.runtimeRole??s.env?.[t.RUNTIME_ROLE_ENV_VAR]??process.env[t.RUNTIME_ROLE_ENV_VAR]))return{ok:!1,status:n.node_misconfigured,body:i("node_misconfigured")};let a=o(s.expectedToken)??function(e=process.env){return o(e.VIBEPULSE_NODE_TOKEN)}(s.env??process.env);if("1"!==e.headers.get(r))return{ok:!1,status:n.unsupported_node_version,body:i("unsupported_node_version")};if(a){var u;let t,r=(u=e.headers.get("authorization"),t=u?.match(/^Bearer\s+(.+)$/i),o(t?.[1]));if(!r||r!==a)return{ok:!1,status:n.unauthorized,body:i("unauthorized")}}return{ok:!0}}e.s(["NODE_PROTOCOL_VERSION",0,"1","createNodeFailureResponse",()=>a,"createNodeRequestHeaders",()=>s,"guardNodeRequest",()=>l,"toNodeRequestGuardResponse",()=>u])},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},99686,e=>{"use strict";var t=e.i(33405);let r=new Set;function n(){let e=Number(process.env.OPENCODE_DISCOVERY_TIMEOUT_MS);return Number.isFinite(e)&&e>0?e:5e3}function o(e){if(!(e instanceof Error))return!1;let t=e.message.toLowerCase();return"ETIMEDOUT"===e.code||t.includes("timed out")||t.includes("etimedout")}function s(e){let t=e.deadlineMs-Date.now();return t<=0?(e.timedOut=!0,null):Math.max(1,Math.min(e.timeoutMs,t))}function i(e){return Array.from(new Set(e.filter(e=>Number.isInteger(e)&&e>0&&e<=65535))).sort((e,t)=>e-t)}function a(){let e=n(),a={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},u=i([...function(e){try{let r=s(e);if(null===r)return[];let n=(0,t.execSync)("lsof -nP -iTCP -sTCP:LISTEN",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}).split("\n"),o=[];for(let e of n){let t=e.trim();if(!t||t.startsWith("COMMAND"))continue;let r=t.split(/\s+/),n=r[0]?.toLowerCase();if("opencode"!==n)continue;let s=t.match(/:(\d+)\s+\(LISTEN\)/);if(!s)continue;let i=parseInt(s[1],10);Number.isFinite(i)&&o.push(i)}return o}catch(t){return o(t)&&(e.timedOut=!0),[]}}(a),...function(e){try{let r=s(e);if(null===r)return[];return[...(0,t.execSync)("ps -axo command",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}).matchAll(/\bopencode\b[^\n]*\b--port(?:=|\s+)(\d+)\b/g)].map(e=>parseInt(e[1],10)).filter(e=>Number.isFinite(e))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(a)]);for(let e of u)r.add(e);return{ports:i([...u,...Array.from(r)]),timedOut:a.timedOut}}function u(){let e=n(),r={timedOut:!1,timeoutMs:e,deadlineMs:Date.now()+e},i=function(e){try{let r=s(e);if(null===r)return[];let n=(0,t.execSync)("ps -axo pid=,command=",{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:r}),o=[];for(let e of n.split("\n")){let t=e.trim();if(!t)continue;let r=t.match(/^(\d+)\s+(.+)$/);if(!r)continue;let n=parseInt(r[1],10),s=r[2];Number.isFinite(n)&&/\bopencode\b/.test(s)&&(/\b--port(?:=|\s+)\d+\b/.test(s)||o.push(n))}return Array.from(new Set(o))}catch(t){return o(t)&&(e.timedOut=!0),[]}}(r);if(!i.length)return{processes:[],timedOut:r.timedOut};let a=[],u=new Set;for(let e of i){let n=function(e,r){try{let n=s(r);if(null===n)return null;let o=(0,t.execSync)(`lsof -nP -a -p ${e} -d cwd -Fn`,{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:n}).split("\n").find(e=>e.startsWith("n")&&e.length>1);if(!o)return null;return o.slice(1)}catch(e){return o(e)&&(r.timedOut=!0),null}}(e,r);if(!n)continue;let i=`${e}:${n}`;u.has(i)||(u.add(i),a.push({pid:e,cwd:n}))}return{processes:a,timedOut:r.timedOut}}e.s(["discoverOpencodePortsWithMeta",()=>a,"discoverOpencodeProcessCwdsWithoutPortWithMeta",()=>u])},8322,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),s=e.i(61916),i=e.i(74677),a=e.i(69741),u=e.i(16795),l=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),m=e.i(26937),h=e.i(10372),g=e.i(93695);e.i(52474);var R=e.i(220);e.i(39354);var v=e.i(34959),x=e.i(99686),E=e.i(33405);async function y(e,t){let r=function(e,t,r={}){let n=encodeURI(t.replace(/\\/g,"/")),o="string"==typeof r.remoteSshHost?r.remoteSshHost.trim():"";return"antigravity"===e?`antigravity://file${n.startsWith("/")?n:`/${n}`}`:o?`vscode://vscode-remote/ssh-remote+${o}${n.startsWith("/")?"":"/"}${n}`:`vscode://file${n.startsWith("/")?n:`/${n}`}`}(e,t),{command:n,args:o}=function(e,t=process.platform){return"darwin"===t?{command:"open",args:[e]}:"win32"===t?{command:"explorer",args:[e]}:{command:"xdg-open",args:[e]}}(r);return await new Promise((e,t)=>{(0,E.execFile)(n,o,r=>{r?t(r):e()})}),r}var _=e.i(68817);async function w(e,{params:t}){var r,n;let o,s=(0,_.guardNodeRequest)(e);if(!s.ok)return(0,_.toNodeRequestGuardResponse)(s);let{id:i}=await t,a=!(o=i.trim())||o.includes(":")?null:o;if(!a)return Response.json({error:"Invalid node session id"},{status:400});let u="antigravity"===(n=((r=await e.json().catch(()=>({})))&&"object"==typeof r&&!Array.isArray(r)?r:{}).tool??"vscode")||"vscode"===n?n:null;if(!u)return Response.json({error:"Invalid open tool"},{status:400});let{ports:l,timedOut:d}=(0,x.discoverOpencodePortsWithMeta)();if(!l.length)return(0,_.createNodeFailureResponse)(d?"upstream_timeout":"upstream_unreachable",{role:"node",upstream:{kind:"opencode",reachable:!1}});let c=!1,p=[];for(let e of l)try{let t=(0,v.createOpencodeClient)({baseUrl:`http://localhost:${e}`}),r=await t.session.get({path:{id:a}}),n=r.data?.directory;if("string"!=typeof n||!n.trim()){c=!0;continue}try{let e=await y(u,n);return Response.json({success:!0,uri:e})}catch(e){return Response.json({error:"Editor unavailable",reason:"editor_unavailable",message:e instanceof Error?e.message:String(e)},{status:503})}}catch(e){p.push(e)}if(c)return Response.json({error:"Editor unavailable",reason:"editor_unavailable",message:"Session directory is missing or empty"},{status:503});if(p.length>0){let e=p[p.length-1]?.message;return p.every(e=>/not found|404/i.test(e.message))?Response.json({error:"Session not found",reason:"session_not_found"},{status:404}):Response.json({error:"Failed to open editor for session",reason:"upstream_unreachable",...e?{message:e}:{}},{status:503})}return Response.json({error:"Session not found",reason:"session_not_found"},{status:404})}e.s(["POST",()=>w,"dynamic",0,"force-dynamic"],35331);var b=e.i(35331);let O=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/node/sessions/[id]/open-editor/route",pathname:"/api/node/sessions/[id]/open-editor",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/node/sessions/[id]/open-editor/route.ts",nextConfigOutput:"standalone",userland:b}),{workAsyncStorage:N,workUnitAsyncStorage:C,serverHooks:S}=O;function T(){return(0,n.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:C})}async function A(e,t,n){O.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/node/sessions/[id]/open-editor/route";v=v.replace(/\/index$/,"")||"/";let x=await O.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:E,params:y,nextConfig:_,parsedUrl:w,isDraftMode:b,prerenderManifest:N,routerServerContext:C,isOnDemandRevalidate:S,revalidateOnlyGenerated:T,resolvedPathname:A,clientReferenceManifest:P,serverActionsManifest:I}=x,M=(0,a.normalizeAppPath)(v),j=!!(N.dynamicRoutes[M]||N.routes[A]),k=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,w,!1):t.end("This page could not be found"),null);if(j&&!b){let e=!!N.routes[A],t=N.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(_.experimental.adapterPath)return await k();throw new g.NoFallbackError}}let U=null;!j||O.isDev||b||(U="/index"===(U=A)?"/":U);let q=!0===O.isDev||!j,$=j&&!q;I&&P&&(0,i.setManifestsSingleton)({page:v,clientReferenceManifest:P,serverActionsManifest:I});let D=e.method||"GET",H=(0,s.getTracer)(),F=H.getActiveScopeSpan(),L={params:y,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!_.experimental.authInterrupts},cacheComponents:!!_.cacheComponents,supportsDynamicResponse:q,incrementalCache:(0,o.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:_.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,o)=>O.onRequestError(e,t,n,o,C)},sharedContext:{buildId:E}},V=new u.NodeNextRequest(e),W=new u.NodeNextResponse(t),B=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(t));try{let i=async e=>O.handle(B,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${D} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${D} ${v}`)}),a=!!(0,o.getRequestMeta)(e,"minimalMode"),u=async o=>{var s,u;let l=async({previousCacheEntry:r})=>{try{if(!a&&S&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(o);e.fetchMetrics=L.renderOpts.fetchMetrics;let u=L.renderOpts.pendingWaitUntil;u&&n.waitUntil&&(n.waitUntil(u),u=void 0);let l=L.renderOpts.collectedTags;if(!j)return await (0,p.sendResponse)(V,W,s,L.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[h.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,n=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await O.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:S})},!1,C),t}},d=await O.handleResponse({req:e,nextConfig:_,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:a});if(!j)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(u=d.value)?void 0:u.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});a||t.setHeader("x-nextjs-cache",S?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return a&&j||g.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,m.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(V,W,new Response(d.value.body,{headers:g,status:d.value.status||200})),null};F?await u(F):await H.withPropagatedContext(e.headers,()=>H.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${v}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},u))}catch(t){if(t instanceof g.NoFallbackError||await O.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:S})},!1,C),j)throw t;return await (0,p.sendResponse)(V,W,new Response(null,{status:500})),null}}e.s(["handler",()=>A,"patchFetch",()=>T,"routeModule",()=>O,"serverHooks",()=>S,"workAsyncStorage",()=>N,"workUnitAsyncStorage",()=>C],8322)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__e5df5e5f._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/runtimeMode.ts","../../../src/lib/nodeProtocol.ts","../../../src/lib/opencodeDiscovery.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/node/sessions/%5Bid%5D/open-editor/route.ts","../../../src/lib/editorLauncher.server.ts","../../../src/lib/editorLauncher.ts"],"sourcesContent":["export const NODE_RUNTIME_FLAG = '--serve';\nexport const RUNTIME_ROLE_ENV_VAR = 'VIBEPULSE_RUNTIME_ROLE';\n\nexport type RuntimeRole = 'hub' | 'node';\n\nexport interface RuntimeMode {\n role: RuntimeRole;\n}\n\nfunction formatUsage(args: string[]): string {\n const renderedArgs = args.length > 0 ? args.join(' ') : '(none)';\n return `Unsupported arguments: ${renderedArgs}. Usage: vibepulse [${NODE_RUNTIME_FLAG}]`;\n}\n\nexport function resolveRuntimeMode(argv: string[]): RuntimeMode {\n if (!Array.isArray(argv)) {\n throw new TypeError('Runtime arguments must be provided as an array.');\n }\n\n if (argv.length === 0) {\n return { role: 'hub' };\n }\n\n if (argv.length === 1 && argv[0] === NODE_RUNTIME_FLAG) {\n return { role: 'node' };\n }\n\n throw new Error(formatUsage(argv));\n}\n","import { RUNTIME_ROLE_ENV_VAR } from '@/lib/runtimeMode';\n\nexport const NODE_PROTOCOL_VERSION_HEADER = 'x-vibepulse-node-version';\nexport const NODE_PROTOCOL_VERSION = '1';\nexport const NODE_SHARED_TOKEN_ENV_VAR = 'VIBEPULSE_NODE_TOKEN';\n\nexport type NodeFailureReason =\n | 'unauthorized'\n | 'unsupported_node_version'\n | 'node_misconfigured'\n | 'upstream_unreachable'\n | 'upstream_timeout';\n\nexport interface NodeFailurePayload {\n ok: false;\n reason: NodeFailureReason;\n protocolVersion: typeof NODE_PROTOCOL_VERSION;\n degraded?: boolean;\n [key: string]: unknown;\n}\n\nexport type NodeRequestGuardFailure = {\n ok: false;\n status: number;\n body: NodeFailurePayload;\n};\n\nexport type NodeRequestGuardResult =\n | { ok: true }\n | NodeRequestGuardFailure;\n\nexport interface NodeRequestGuardOptions {\n runtimeRole?: string | undefined;\n expectedToken?: string | undefined;\n env?: NodeJS.ProcessEnv;\n}\n\nconst NODE_FAILURE_STATUS: Record<NodeFailureReason, number> = {\n unauthorized: 401,\n unsupported_node_version: 426,\n node_misconfigured: 503,\n upstream_unreachable: 503,\n upstream_timeout: 504,\n};\n\nfunction trimToNull(value: string | null | undefined): string | null {\n if (typeof value !== 'string') {\n return null;\n }\n\n const trimmed = value.trim();\n return trimmed ? trimmed : null;\n}\n\nfunction readBearerToken(authorizationHeader: string | null): string | null {\n const match = authorizationHeader?.match(/^Bearer\\s+(.+)$/i);\n return trimToNull(match?.[1]);\n}\n\nfunction isDegradedReason(reason: NodeFailureReason): boolean {\n return reason === 'node_misconfigured' || reason === 'upstream_unreachable' || reason === 'upstream_timeout';\n}\n\nexport function getConfiguredNodeToken(env: NodeJS.ProcessEnv = process.env): string | null {\n return trimToNull(env[NODE_SHARED_TOKEN_ENV_VAR]);\n}\n\nexport function createNodeRequestHeaders(token?: string | null, headers?: HeadersInit): Headers {\n const requestHeaders = new Headers(headers);\n requestHeaders.set(NODE_PROTOCOL_VERSION_HEADER, NODE_PROTOCOL_VERSION);\n\n const trimmedToken = trimToNull(token ?? null);\n if (trimmedToken) {\n requestHeaders.set('authorization', `Bearer ${trimmedToken}`);\n }\n\n return requestHeaders;\n}\n\nexport function createNodeFailurePayload(\n reason: NodeFailureReason,\n extras?: Record<string, unknown>\n): NodeFailurePayload {\n return {\n ok: false,\n reason,\n protocolVersion: NODE_PROTOCOL_VERSION,\n ...(isDegradedReason(reason) ? { degraded: true } : {}),\n ...(extras ?? {}),\n };\n}\n\nexport function createNodeFailureResponse(\n reason: NodeFailureReason,\n extras?: Record<string, unknown>\n): Response {\n return Response.json(createNodeFailurePayload(reason, extras), {\n status: NODE_FAILURE_STATUS[reason],\n });\n}\n\nexport function toNodeRequestGuardResponse(failure: NodeRequestGuardFailure): Response {\n return Response.json(failure.body, { status: failure.status });\n}\n\nexport function guardNodeRequest(\n request: Request,\n options: NodeRequestGuardOptions = {}\n): NodeRequestGuardResult {\n const runtimeRole = options.runtimeRole ?? options.env?.[RUNTIME_ROLE_ENV_VAR] ?? process.env[RUNTIME_ROLE_ENV_VAR];\n if (runtimeRole !== 'node') {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.node_misconfigured,\n body: createNodeFailurePayload('node_misconfigured'),\n };\n }\n\n const expectedToken = trimToNull(options.expectedToken) ?? getConfiguredNodeToken(options.env ?? process.env);\n\n const version = request.headers.get(NODE_PROTOCOL_VERSION_HEADER);\n if (version !== NODE_PROTOCOL_VERSION) {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.unsupported_node_version,\n body: createNodeFailurePayload('unsupported_node_version'),\n };\n }\n\n if (expectedToken) {\n const presentedToken = readBearerToken(request.headers.get('authorization'));\n if (!presentedToken || presentedToken !== expectedToken) {\n return {\n ok: false,\n status: NODE_FAILURE_STATUS.unauthorized,\n body: createNodeFailurePayload('unauthorized'),\n };\n }\n }\n\n return { ok: true };\n}\n","import { execSync } from 'child_process';\n\nconst DEFAULT_DISCOVERY_COMMAND_TIMEOUT_MS = 5000;\nconst knownPorts = new Set<number>();\n\nexport type OpencodeProcessCwd = {\n pid: number;\n cwd: string;\n};\n\nexport type OpencodePortDiscoveryResult = {\n ports: number[];\n timedOut: boolean;\n};\n\nexport type OpencodeProcessCwdDiscoveryResult = {\n processes: OpencodeProcessCwd[];\n timedOut: boolean;\n};\n\ntype DiscoveryState = {\n timedOut: boolean;\n timeoutMs: number;\n deadlineMs: number;\n};\n\nfunction getDiscoveryCommandTimeoutMs(): number {\n const parsedTimeout = Number(process.env.OPENCODE_DISCOVERY_TIMEOUT_MS);\n return Number.isFinite(parsedTimeout) && parsedTimeout > 0\n ? parsedTimeout\n : DEFAULT_DISCOVERY_COMMAND_TIMEOUT_MS;\n}\n\nfunction isCommandTimeoutError(error: unknown): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n type TimeoutLikeError = Error & {\n code?: string;\n signal?: string;\n killed?: boolean;\n };\n\n const timeoutError = error as TimeoutLikeError;\n const message = timeoutError.message.toLowerCase();\n return timeoutError.code === 'ETIMEDOUT' || message.includes('timed out') || message.includes('etimedout');\n}\n\nfunction getRemainingTimeoutMs(state: DiscoveryState): number | null {\n const remainingMs = state.deadlineMs - Date.now();\n if (remainingMs <= 0) {\n state.timedOut = true;\n return null;\n }\n\n return Math.max(1, Math.min(state.timeoutMs, remainingMs));\n}\n\nfunction toUniqueSortedPorts(ports: number[]): number[] {\n return Array.from(\n new Set(ports.filter((port) => Number.isInteger(port) && port > 0 && port <= 65535))\n ).sort((a, b) => a - b);\n}\n\nfunction getPortsFromLsof(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('lsof -nP -iTCP -sTCP:LISTEN', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n const lines = output.split('\\n');\n const ports: number[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('COMMAND')) {\n continue;\n }\n\n const parts = trimmed.split(/\\s+/);\n const command = parts[0]?.toLowerCase();\n if (command !== 'opencode') {\n continue;\n }\n\n const match = trimmed.match(/:(\\d+)\\s+\\(LISTEN\\)/);\n if (!match) {\n continue;\n }\n\n const port = parseInt(match[1], 10);\n if (Number.isFinite(port)) {\n ports.push(port);\n }\n }\n\n return ports;\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nfunction getPortsFromProcessArgs(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('ps -axo command', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n const matches = [...output.matchAll(/\\bopencode\\b[^\\n]*\\b--port(?:=|\\s+)(\\d+)\\b/g)];\n return matches\n .map((match) => parseInt(match[1], 10))\n .filter((port) => Number.isFinite(port));\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nexport function discoverOpencodePorts(): number[] {\n return discoverOpencodePortsWithMeta().ports;\n}\n\nexport function discoverOpencodePortsWithMeta(): OpencodePortDiscoveryResult {\n const timeoutMs = getDiscoveryCommandTimeoutMs();\n const state: DiscoveryState = {\n timedOut: false,\n timeoutMs,\n deadlineMs: Date.now() + timeoutMs,\n };\n\n const discoveredPorts = toUniqueSortedPorts([\n ...getPortsFromLsof(state),\n ...getPortsFromProcessArgs(state),\n ]);\n\n for (const port of discoveredPorts) {\n knownPorts.add(port);\n }\n\n const ports = toUniqueSortedPorts([\n ...discoveredPorts,\n ...Array.from(knownPorts),\n ]);\n\n return {\n ports,\n timedOut: state.timedOut,\n };\n}\n\nfunction getOpencodePidsWithoutPortFlag(state: DiscoveryState): number[] {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return [];\n }\n\n const output = execSync('ps -axo pid=,command=', {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n\n const pids: number[] = [];\n const lines = output.split('\\n');\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n\n const match = trimmed.match(/^(\\d+)\\s+(.+)$/);\n if (!match) continue;\n\n const pid = parseInt(match[1], 10);\n const command = match[2];\n\n if (!Number.isFinite(pid)) continue;\n if (!/\\bopencode\\b/.test(command)) continue;\n if (/\\b--port(?:=|\\s+)\\d+\\b/.test(command)) continue;\n\n pids.push(pid);\n }\n\n return Array.from(new Set(pids));\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return [];\n }\n}\n\nfunction getCwdForPid(pid: number, state: DiscoveryState): string | null {\n try {\n const timeoutMs = getRemainingTimeoutMs(state);\n if (timeoutMs === null) {\n return null;\n }\n\n const output = execSync(`lsof -nP -a -p ${pid} -d cwd -Fn`, {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: timeoutMs,\n });\n\n const cwdLine = output\n .split('\\n')\n .find((line) => line.startsWith('n') && line.length > 1);\n\n if (!cwdLine) return null;\n return cwdLine.slice(1);\n } catch (error) {\n if (isCommandTimeoutError(error)) {\n state.timedOut = true;\n }\n return null;\n }\n}\n\nexport function discoverOpencodeProcessCwdsWithoutPort(): OpencodeProcessCwd[] {\n return discoverOpencodeProcessCwdsWithoutPortWithMeta().processes;\n}\n\nexport function discoverOpencodeProcessCwdsWithoutPortWithMeta(): OpencodeProcessCwdDiscoveryResult {\n const timeoutMs = getDiscoveryCommandTimeoutMs();\n const state: DiscoveryState = {\n timedOut: false,\n timeoutMs,\n deadlineMs: Date.now() + timeoutMs,\n };\n\n const pids = getOpencodePidsWithoutPortFlag(state);\n if (!pids.length) {\n return {\n processes: [],\n timedOut: state.timedOut,\n };\n }\n\n const processes: OpencodeProcessCwd[] = [];\n const seen = new Set<string>();\n\n for (const pid of pids) {\n const cwd = getCwdForPid(pid, state);\n if (!cwd) continue;\n\n const key = `${pid}:${cwd}`;\n if (seen.has(key)) continue;\n seen.add(key);\n processes.push({ pid, cwd });\n }\n\n return {\n processes,\n timedOut: state.timedOut,\n };\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/node/sessions/[id]/open-editor/route\",\n pathname: \"/api/node/sessions/[id]/open-editor\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/node/sessions/[id]/open-editor/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/node/sessions/[id]/open-editor/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { createOpencodeClient } from '@opencode-ai/sdk';\nimport { discoverOpencodePortsWithMeta } from '@/lib/opencodeDiscovery';\nimport type { OpenEditorTool } from '@/lib/editorLauncher';\nimport { openEditorOnCurrentMachine } from '@/lib/editorLauncher.server';\nimport {\n createNodeFailureResponse,\n guardNodeRequest,\n toNodeRequestGuardResponse,\n} from '@/lib/nodeProtocol';\n\nfunction resolveNodeLocalSessionId(id: string): string | null {\n const trimmedId = id.trim();\n if (!trimmedId || trimmedId.includes(':')) {\n return null;\n }\n\n return trimmedId;\n}\n\nfunction resolveOpenEditorTool(value: unknown): OpenEditorTool | null {\n return value === 'antigravity' || value === 'vscode' ? value : null;\n}\n\nfunction toRequestBodyRecord(value: unknown): Record<string, unknown> {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\n\nexport const dynamic = 'force-dynamic';\n\nexport async function POST(request: Request, { params }: { params: Promise<{ id: string }> }) {\n const guardResult = guardNodeRequest(request);\n if (!guardResult.ok) {\n return toNodeRequestGuardResponse(guardResult);\n }\n\n const { id } = await params;\n const sessionId = resolveNodeLocalSessionId(id);\n\n if (!sessionId) {\n return Response.json({ error: 'Invalid node session id' }, { status: 400 });\n }\n\n const parsedBody = await request.json().catch(() => ({}));\n const body = toRequestBodyRecord(parsedBody);\n const tool = resolveOpenEditorTool(body.tool ?? 'vscode');\n if (!tool) {\n return Response.json({ error: 'Invalid open tool' }, { status: 400 });\n }\n\n const { ports, timedOut } = discoverOpencodePortsWithMeta();\n if (!ports.length) {\n return createNodeFailureResponse(timedOut ? 'upstream_timeout' : 'upstream_unreachable', {\n role: 'node',\n upstream: {\n kind: 'opencode',\n reachable: false,\n },\n });\n }\n\n let sawMissingDirectory = false;\n const errors: Error[] = [];\n\n for (const port of ports) {\n try {\n const client = createOpencodeClient({ baseUrl: `http://localhost:${port}` });\n const result = await client.session.get({ path: { id: sessionId } });\n const directory = result.data?.directory;\n\n if (typeof directory !== 'string' || !directory.trim()) {\n sawMissingDirectory = true;\n continue;\n }\n\n try {\n const uri = await openEditorOnCurrentMachine(tool, directory);\n return Response.json({ success: true, uri });\n } catch (error) {\n return Response.json(\n {\n error: 'Editor unavailable',\n reason: 'editor_unavailable',\n message: error instanceof Error ? error.message : String(error),\n },\n { status: 503 }\n );\n }\n } catch (error) {\n errors.push(error as Error);\n }\n }\n\n if (sawMissingDirectory) {\n return Response.json(\n {\n error: 'Editor unavailable',\n reason: 'editor_unavailable',\n message: 'Session directory is missing or empty',\n },\n { status: 503 }\n );\n }\n\n if (errors.length > 0) {\n const lastErrorMessage = errors[errors.length - 1]?.message;\n if (errors.every((error) => /not found|404/i.test(error.message))) {\n return Response.json({ error: 'Session not found', reason: 'session_not_found' }, { status: 404 });\n }\n\n return Response.json(\n {\n error: 'Failed to open editor for session',\n reason: 'upstream_unreachable',\n ...(lastErrorMessage ? { message: lastErrorMessage } : {}),\n },\n { status: 503 }\n );\n }\n\n return Response.json({ error: 'Session not found', reason: 'session_not_found' }, { status: 404 });\n}\n","import { execFile } from 'child_process';\n\nimport { buildEditorUri, type OpenEditorTool } from './editorLauncher';\n\nexport function getEditorLaunchCommand(\n uri: string,\n platform: NodeJS.Platform = process.platform\n): { command: string; args: string[] } {\n if (platform === 'darwin') {\n return { command: 'open', args: [uri] };\n }\n\n if (platform === 'win32') {\n return { command: 'explorer', args: [uri] };\n }\n\n return { command: 'xdg-open', args: [uri] };\n}\n\nexport async function openEditorOnCurrentMachine(tool: OpenEditorTool, directory: string): Promise<string> {\n const uri = buildEditorUri(tool, directory);\n const { command, args } = getEditorLaunchCommand(uri);\n\n await new Promise<void>((resolve, reject) => {\n execFile(command, args, (error) => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve();\n });\n });\n\n return uri;\n}\n","export type OpenEditorTool = 'vscode' | 'antigravity';\n\nexport interface BuildEditorUriOptions {\n remoteSshHost?: string | null;\n}\n\nfunction toPosixPath(directory: string): string {\n return directory.replace(/\\\\/g, '/');\n}\n\nexport function buildEditorUri(tool: OpenEditorTool, directory: string, options: BuildEditorUriOptions = {}): string {\n const normalizedDirectory = toPosixPath(directory);\n const encodedPath = encodeURI(normalizedDirectory);\n const remoteSshHost = typeof options.remoteSshHost === 'string' ? options.remoteSshHost.trim() : '';\n\n if (tool === 'antigravity') {\n return `antigravity://file${encodedPath.startsWith('/') ? encodedPath : `/${encodedPath}`}`;\n }\n\n if (remoteSshHost) {\n return `vscode://vscode-remote/ssh-remote+${remoteSshHost}${encodedPath.startsWith('/') ? '' : '/'}${encodedPath}`;\n }\n\n return `vscode://file${encodedPath.startsWith('/') ? encodedPath : `/${encodedPath}`}`;\n}\n"],"names":[],"mappings":"qEACoC,mDCDpC,IAAA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAA+B,2BAmCtC,EAAyD,CAC7D,aAAc,IACd,yBAA0B,IAC1B,mBAAoB,IACpB,qBAAsB,IACtB,iBAAkB,GACpB,EAEA,SAAS,EAAW,CAAgC,QAClD,AAAqB,UAAU,AAA3B,OAAO,EACF,KAGO,AACT,EADe,IAAI,IACT,AAAU,IAC7B,CAeO,SAAS,EAAyB,CAAqB,CAAE,CAAqB,EACnF,IAAM,EAAiB,IAAI,QAAQ,GACnC,EAAe,GAAG,CAAC,OAEnB,IAAM,EAAe,EAAW,GAAS,MAKzC,MAPiD,CAG7C,GACF,EAAe,GAAG,CAAC,KADH,WACoB,CAAC,OAAO,EAAE,EAAA,CAAc,EAGvD,CACT,CAEO,SAAS,EACd,CAAyB,CACzB,CAAgC,EAEhC,MAAO,CACL,IAAI,SACJ,EACA,iBAAiB,GACjB,GAAI,AA3BC,AAAW,0BAAwB,AAAW,4BAA0B,AAAW,qBA2BnE,EAAU,CAAE,SAAU,EAAK,EAAI,CAAC,CAAC,CACtD,GAAI,GAAU,CAAC,CAAC,AAClB,CACF,CAEO,SAAS,EACd,CAAyB,CACzB,CAAgC,EAEhC,OAAO,SAAS,IAAI,CAAC,EAAyB,EAAQ,GAAS,CAC7D,OAAQ,CAAmB,CAAC,EAAO,AACrC,EACF,CAEO,SAAS,EAA2B,CAAgC,EACzE,OAAO,SAAS,IAAI,CAAC,EAAQ,IAAI,CAAE,CAAE,OAAQ,EAAQ,MAAM,AAAC,EAC9D,CAEO,SAAS,EACd,CAAgB,CAChB,EAAmC,CAAC,CAAC,EAGrC,GAAI,AAAgB,QAAQ,EADR,EAAQ,WAAW,EAAI,EAAQ,GAAG,EAAE,CAAC,EAAA,oBAAoB,CAAC,E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AClC,EACA,sBACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[3]}
|
package/.next/server/chunks/_next-internal_server_app_api_node_events_route_actions_f1abd32d.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/.next/server/chunks/_next-internal_server_app_api_node_health_route_actions_c4c4c077.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[59462,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),s=e.i(59756),o=e.i(61916),a=e.i(74677),i=e.i(69741),l=e.i(16795),u=e.i(87718),p=e.i(95169),d=e.i(47587),c=e.i(66012),f=e.i(70101),b=e.i(26937),g=e.i(10372),m=e.i(93695);e.i(52474);var R=e.i(220),v=e.i(89171),y=e.i(57181);let h=["model","temperature","top_p","variant","prompt_append"];function j(e){let t={};for(let r of h)void 0!==e[r]&&(t[r]=e[r]);return t}async function x(){try{let e=await (0,y.readConfig)(),t=e.agents||{},r={};for(let[e,n]of Object.entries(t))"object"==typeof n&&null!==n&&(r[e]=j(n));let n=e.categories||{},s={};for(let[e,t]of Object.entries(n))"object"!=typeof t||null===t||Array.isArray(t)||(s[e]=j(t));let o=e.vibepulse&&"object"==typeof e.vibepulse&&!Array.isArray(e.vibepulse)?e.vibepulse:{};return v.NextResponse.json({agents:r,categories:s,vibepulse:o})}catch(e){return console.error("Error reading config:",e),v.NextResponse.json({error:"Internal server error"},{status:500})}}async function A(e){try{let t=await e.json();if(!t||"object"!=typeof t)return v.NextResponse.json({error:"Invalid request body"},{status:400});let{agents:r,categories:n,vibepulse:s}=t;if(void 0===r&&void 0===n&&void 0===s)return v.NextResponse.json({error:"Missing agents, categories, or vibepulse field"},{status:400});if(void 0!==r&&("object"!=typeof r||null===r||Array.isArray(r)))return v.NextResponse.json({error:"Agents must be an object"},{status:400});if(void 0!==n&&("object"!=typeof n||null===n||Array.isArray(n)))return v.NextResponse.json({error:"Categories must be an object"},{status:400});if(void 0!==s&&("object"!=typeof s||null===s||Array.isArray(s)))return v.NextResponse.json({error:"Vibepulse must be an object"},{status:400});let o=await (0,y.readConfig)(),a=o.agents||{},i={};for(let[e,t]of Object.entries(a))"object"!=typeof t||null===t||Array.isArray(t)||(i[e]=t);if(void 0!==r)for(let[e,t]of Object.entries(r)){if("object"!=typeof t||null===t||Array.isArray(t))return v.NextResponse.json({error:`Agent '${e}' config must be an object`},{status:400});let r=[];for(let e of Object.keys(t)){let t=e.toLowerCase();(t.includes("api")||t.includes("key")||t.includes("token")||t.includes("secret")||t.includes("password")||t.includes("auth")||t.includes("credential")||t.includes("private")||t.includes("cert"))&&r.push(e)}if(r.length>0)return v.NextResponse.json({error:`Agent '${e}' contains disallowed fields: ${r.join(", ")}`},{status:403});let n={};for(let[r,s]of Object.entries(t)){let t=r.toLowerCase();if("model"===t){if("string"!=typeof s||""===s.trim())return v.NextResponse.json({error:`Agent '${e}': model must be a non-empty string`},{status:400});n[r]=s}else if("temperature"===t){let t=Number(s);if(isNaN(t)||t<0||t>2)return v.NextResponse.json({error:`Agent '${e}': temperature must be a number between 0 and 2`},{status:400});n[r]=t}else if("top_p"===t){let t=Number(s);if(isNaN(t)||t<0||t>1)return v.NextResponse.json({error:`Agent '${e}': top_p must be a number between 0 and 1`},{status:400});n[r]=t}else if("variant"===t){if("string"!=typeof s)return v.NextResponse.json({error:`Agent '${e}': variant must be a string`},{status:400});n[r]=s}else{if("prompt_append"!==t)return v.NextResponse.json({error:`Agent '${e}': unknown field '${r}'. Allowed fields: model, temperature, top_p, variant, prompt_append`},{status:400});if("string"!=typeof s)return v.NextResponse.json({error:`Agent '${e}': prompt_append must be a string`},{status:400});n[r]=s}}i[e]={...a[e]||{},...n}}let l={},u=o.categories||{};for(let[e,t]of Object.entries(u))"object"!=typeof t||null===t||Array.isArray(t)||(l[e]=t);if(void 0!==n)for(let[e,t]of Object.entries(n)){if("object"!=typeof t||null===t||Array.isArray(t))return v.NextResponse.json({error:`Category '${e}' config must be an object`},{status:400});let r={};for(let[n,s]of Object.entries(t))if("model"===n||"variant"===n||"prompt_append"===n||"description"===n){if(void 0!==s&&"string"!=typeof s)return v.NextResponse.json({error:`Category '${e}': '${n}' must be a string`},{status:400});r[n]=s}else{if("temperature"!==n&&"top_p"!==n)return v.NextResponse.json({error:`Category '${e}': unknown field '${n}'`},{status:400});if(void 0!==s&&"number"!=typeof s)return v.NextResponse.json({error:`Category '${e}': '${n}' must be a number`},{status:400});let t="temperature"===n?Math.max(0,Math.min(2,s)):s,o="top_p"===n?Math.max(0,Math.min(1,s)):s;r[n]="temperature"===n?t:o}l[e]={...u[e]||{},...r}}let p={},d=o.vibepulse&&"object"==typeof o.vibepulse&&!Array.isArray(o.vibepulse)?o.vibepulse:{};if(void 0!==s){for(let[e,t]of Object.entries(d))p[e]=t;for(let[e,t]of Object.entries(s))if("stickyBusyDelayMs"!==e&&"sessionsRefreshIntervalMs"!==e)return v.NextResponse.json({error:`Vibepulse: unknown field '${e}'`},{status:400});else{if(void 0!==t&&"number"!=typeof t)return v.NextResponse.json({error:`Vibepulse: '${e}' must be a number`},{status:400});if("number"==typeof t){if(!Number.isFinite(t))return v.NextResponse.json({error:`Vibepulse: '${e}' must be a finite number`},{status:400});if("stickyBusyDelayMs"===e&&t<0)return v.NextResponse.json({error:`Vibepulse: '${e}' must be a non-negative number`},{status:400});if("sessionsRefreshIntervalMs"===e&&t<=0)return v.NextResponse.json({error:`Vibepulse: '${e}' must be greater than 0`},{status:400});p[e]=t}}}let c={...o};return void 0!==r&&(c.agents=i),void 0!==n&&(c.categories=l),void 0!==s&&(c.vibepulse=p),await (0,y.writeConfig)(c),v.NextResponse.json({success:!0,agents:i,categories:l,vibepulse:p},{status:200})}catch(e){return console.error("Error updating config:",e),v.NextResponse.json({error:"Internal server error"},{status:500})}}e.s(["GET",()=>x,"POST",()=>A],7526);var N=e.i(7526);let w=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/opencode-config/route",pathname:"/api/opencode-config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/opencode-config/route.ts",nextConfigOutput:"standalone",userland:N}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:O}=w;function $(){return(0,n.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})}async function _(e,t,n){w.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/opencode-config/route";v=v.replace(/\/index$/,"")||"/";let y=await w.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:h,params:j,nextConfig:x,parsedUrl:A,isDraftMode:N,prerenderManifest:C,routerServerContext:E,isOnDemandRevalidate:O,revalidateOnlyGenerated:$,resolvedPathname:_,clientReferenceManifest:T,serverActionsManifest:P}=y,k=(0,i.normalizeAppPath)(v),M=!!(C.dynamicRoutes[k]||C.routes[_]),I=async()=>((null==E?void 0:E.render404)?await E.render404(e,t,A,!1):t.end("This page could not be found"),null);if(M&&!N){let e=!!C.routes[_],t=C.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(x.experimental.adapterPath)return await I();throw new m.NoFallbackError}}let S=null;!M||w.isDev||N||(S="/index"===(S=_)?"/":S);let H=!0===w.isDev||!M,U=M&&!H;P&&T&&(0,a.setManifestsSingleton)({page:v,clientReferenceManifest:T,serverActionsManifest:P});let q=e.method||"GET",D=(0,o.getTracer)(),F=D.getActiveScopeSpan(),V={params:j,prerenderManifest:C,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,s.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:x.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,s)=>w.onRequestError(e,t,n,s,E)},sharedContext:{buildId:h}},K=new l.NodeNextRequest(e),B=new l.NodeNextResponse(t),L=u.NextRequestAdapter.fromNodeNextRequest(K,(0,u.signalFromNodeResponse)(t));try{let a=async e=>w.handle(L,V).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=D.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${q} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${q} ${v}`)}),i=!!(0,s.getRequestMeta)(e,"minimalMode"),l=async s=>{var o,l;let u=async({previousCacheEntry:r})=>{try{if(!i&&O&&$&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await a(s);e.fetchMetrics=V.renderOpts.fetchMetrics;let l=V.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let u=V.renderOpts.collectedTags;if(!M)return await (0,c.sendResponse)(K,B,o,V.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(o.headers);u&&(t[g.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==V.renderOpts.collectedRevalidate&&!(V.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&V.renderOpts.collectedRevalidate,n=void 0===V.renderOpts.collectedExpire||V.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:V.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await w.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:O})},!1,E),t}},p=await w.handleResponse({req:e,nextConfig:x,cacheKey:S,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:$,responseGenerator:u,waitUntil:n.waitUntil,isMinimalMode:i});if(!M)return null;if((null==p||null==(o=p.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(l=p.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",O?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,f.fromNodeOutgoingHttpHeaders)(p.value.headers);return i&&M||m.delete(g.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,b.getCacheControlHeader)(p.cacheControl)),await (0,c.sendResponse)(K,B,new Response(p.value.body,{headers:m,status:p.value.status||200})),null};F?await l(F):await D.withPropagatedContext(e.headers,()=>D.trace(p.BaseServerSpan.handleRequest,{spanName:`${q} ${v}`,kind:o.SpanKind.SERVER,attributes:{"http.method":q,"http.target":e.url}},l))}catch(t){if(t instanceof m.NoFallbackError||await w.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:O})},!1,E),M)throw t;return await (0,c.sendResponse)(K,B,new Response(null,{status:500})),null}}e.s(["handler",()=>_,"patchFetch",()=>$,"routeModule",()=>w,"serverHooks",()=>O,"workAsyncStorage",()=>C,"workUnitAsyncStorage",()=>E],59462)}];
|
|
1
|
+
module.exports=[59462,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),s=e.i(59756),o=e.i(61916),a=e.i(74677),i=e.i(69741),u=e.i(16795),l=e.i(87718),p=e.i(95169),d=e.i(47587),c=e.i(66012),f=e.i(70101),b=e.i(26937),g=e.i(10372),m=e.i(93695);e.i(52474);var R=e.i(220),h=e.i(89171),v=e.i(57181);let y=["model","temperature","top_p","variant","prompt_append"];function j(e){let t={};for(let r of y)void 0!==e[r]&&(t[r]=e[r]);return t}async function x(){try{let e=await (0,v.readConfig)(),t=e.agents||{},r={};for(let[e,n]of Object.entries(t))"object"==typeof n&&null!==n&&(r[e]=j(n));let n=e.categories||{},s={};for(let[e,t]of Object.entries(n))"object"!=typeof t||null===t||Array.isArray(t)||(s[e]=j(t));let o=(0,v.normalizeVibePulseConfig)(e.vibepulse);return h.NextResponse.json({agents:r,categories:s,vibepulse:o})}catch(e){return console.error("Error reading config:",e),h.NextResponse.json({error:"Internal server error"},{status:500})}}async function N(e){try{let t=await e.json();if(!t||"object"!=typeof t)return h.NextResponse.json({error:"Invalid request body"},{status:400});let{agents:r,categories:n,vibepulse:s}=t;if(void 0===r&&void 0===n&&void 0===s)return h.NextResponse.json({error:"Missing agents, categories, or vibepulse field"},{status:400});if(void 0!==r&&("object"!=typeof r||null===r||Array.isArray(r)))return h.NextResponse.json({error:"Agents must be an object"},{status:400});if(void 0!==n&&("object"!=typeof n||null===n||Array.isArray(n)))return h.NextResponse.json({error:"Categories must be an object"},{status:400});if(void 0!==s&&("object"!=typeof s||null===s||Array.isArray(s)))return h.NextResponse.json({error:"Vibepulse must be an object"},{status:400});let o=await (0,v.readConfig)(),a=o.agents||{},i={};for(let[e,t]of Object.entries(a))"object"!=typeof t||null===t||Array.isArray(t)||(i[e]=t);if(void 0!==r)for(let[e,t]of Object.entries(r)){if("object"!=typeof t||null===t||Array.isArray(t))return h.NextResponse.json({error:`Agent '${e}' config must be an object`},{status:400});let r=[];for(let e of Object.keys(t)){let t=e.toLowerCase();(t.includes("api")||t.includes("key")||t.includes("token")||t.includes("secret")||t.includes("password")||t.includes("auth")||t.includes("credential")||t.includes("private")||t.includes("cert"))&&r.push(e)}if(r.length>0)return h.NextResponse.json({error:`Agent '${e}' contains disallowed fields: ${r.join(", ")}`},{status:403});let n={};for(let[r,s]of Object.entries(t)){let t=r.toLowerCase();if("model"===t){if("string"!=typeof s||""===s.trim())return h.NextResponse.json({error:`Agent '${e}': model must be a non-empty string`},{status:400});n[r]=s}else if("temperature"===t){let t=Number(s);if(isNaN(t)||t<0||t>2)return h.NextResponse.json({error:`Agent '${e}': temperature must be a number between 0 and 2`},{status:400});n[r]=t}else if("top_p"===t){let t=Number(s);if(isNaN(t)||t<0||t>1)return h.NextResponse.json({error:`Agent '${e}': top_p must be a number between 0 and 1`},{status:400});n[r]=t}else if("variant"===t){if("string"!=typeof s)return h.NextResponse.json({error:`Agent '${e}': variant must be a string`},{status:400});n[r]=s}else{if("prompt_append"!==t)return h.NextResponse.json({error:`Agent '${e}': unknown field '${r}'. Allowed fields: model, temperature, top_p, variant, prompt_append`},{status:400});if("string"!=typeof s)return h.NextResponse.json({error:`Agent '${e}': prompt_append must be a string`},{status:400});n[r]=s}}i[e]={...a[e]||{},...n}}let u={},l=o.categories||{};for(let[e,t]of Object.entries(l))"object"!=typeof t||null===t||Array.isArray(t)||(u[e]=t);if(void 0!==n)for(let[e,t]of Object.entries(n)){if("object"!=typeof t||null===t||Array.isArray(t))return h.NextResponse.json({error:`Category '${e}' config must be an object`},{status:400});let r={};for(let[n,s]of Object.entries(t))if("model"===n||"variant"===n||"prompt_append"===n||"description"===n){if(void 0!==s&&"string"!=typeof s)return h.NextResponse.json({error:`Category '${e}': '${n}' must be a string`},{status:400});r[n]=s}else{if("temperature"!==n&&"top_p"!==n)return h.NextResponse.json({error:`Category '${e}': unknown field '${n}'`},{status:400});if(void 0!==s&&"number"!=typeof s)return h.NextResponse.json({error:`Category '${e}': '${n}' must be a number`},{status:400});let t="temperature"===n?Math.max(0,Math.min(2,s)):s,o="top_p"===n?Math.max(0,Math.min(1,s)):s;r[n]="temperature"===n?t:o}u[e]={...l[e]||{},...r}}let p={},d=(0,v.normalizeVibePulseConfig)(o.vibepulse);if(void 0!==s){for(let[e,t]of Object.entries(d))p[e]=t;for(let[e,t]of Object.entries(s))if("stickyBusyDelayMs"===e||"sessionsRefreshIntervalMs"===e){if(void 0!==t&&"number"!=typeof t)return h.NextResponse.json({error:`Vibepulse: '${e}' must be a number`},{status:400});if("number"==typeof t){if(!Number.isFinite(t))return h.NextResponse.json({error:`Vibepulse: '${e}' must be a finite number`},{status:400});if("stickyBusyDelayMs"===e&&t<0)return h.NextResponse.json({error:`Vibepulse: '${e}' must be a non-negative number`},{status:400});if("sessionsRefreshIntervalMs"===e&&t<=0)return h.NextResponse.json({error:`Vibepulse: '${e}' must be greater than 0`},{status:400});p[e]=t}}else{if("openEditorTargetMode"!==e)return h.NextResponse.json({error:`Vibepulse: unknown field '${e}'`},{status:400});if("remote"!==t&&"hub"!==t)return h.NextResponse.json({error:`Vibepulse: '${e}' must be either 'remote' or 'hub'`},{status:400});p[e]=t}}let c={...o};return void 0!==r&&(c.agents=i),void 0!==n&&(c.categories=u),void 0!==s&&(c.vibepulse=p),await (0,v.writeConfig)(c),h.NextResponse.json({success:!0,agents:i,categories:u,vibepulse:p},{status:200})}catch(e){return console.error("Error updating config:",e),h.NextResponse.json({error:"Internal server error"},{status:500})}}e.s(["GET",()=>x,"POST",()=>N],7526);var A=e.i(7526);let w=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/opencode-config/route",pathname:"/api/opencode-config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/opencode-config/route.ts",nextConfigOutput:"standalone",userland:A}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:O}=w;function $(){return(0,n.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})}async function _(e,t,n){w.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let h="/api/opencode-config/route";h=h.replace(/\/index$/,"")||"/";let v=await w.prepare(e,t,{srcPage:h,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,params:j,nextConfig:x,parsedUrl:N,isDraftMode:A,prerenderManifest:C,routerServerContext:E,isOnDemandRevalidate:O,revalidateOnlyGenerated:$,resolvedPathname:_,clientReferenceManifest:T,serverActionsManifest:P}=v,M=(0,i.normalizeAppPath)(h),k=!!(C.dynamicRoutes[M]||C.routes[_]),I=async()=>((null==E?void 0:E.render404)?await E.render404(e,t,N,!1):t.end("This page could not be found"),null);if(k&&!A){let e=!!C.routes[_],t=C.dynamicRoutes[M];if(t&&!1===t.fallback&&!e){if(x.experimental.adapterPath)return await I();throw new m.NoFallbackError}}let S=null;!k||w.isDev||A||(S="/index"===(S=_)?"/":S);let H=!0===w.isDev||!k,U=k&&!H;P&&T&&(0,a.setManifestsSingleton)({page:h,clientReferenceManifest:T,serverActionsManifest:P});let q=e.method||"GET",D=(0,o.getTracer)(),V=D.getActiveScopeSpan(),F={params:j,prerenderManifest:C,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,s.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:x.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,s)=>w.onRequestError(e,t,n,s,E)},sharedContext:{buildId:y}},K=new u.NodeNextRequest(e),B=new u.NodeNextResponse(t),L=l.NextRequestAdapter.fromNodeNextRequest(K,(0,l.signalFromNodeResponse)(t));try{let a=async e=>w.handle(L,F).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=D.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route");if(n){let t=`${q} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${q} ${h}`)}),i=!!(0,s.getRequestMeta)(e,"minimalMode"),u=async s=>{var o,u;let l=async({previousCacheEntry:r})=>{try{if(!i&&O&&$&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await a(s);e.fetchMetrics=F.renderOpts.fetchMetrics;let u=F.renderOpts.pendingWaitUntil;u&&n.waitUntil&&(n.waitUntil(u),u=void 0);let l=F.renderOpts.collectedTags;if(!k)return await (0,c.sendResponse)(K,B,o,F.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[g.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,n=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=g.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await w.onRequestError(e,t,{routerKind:"App Router",routePath:h,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:O})},!1,E),t}},p=await w.handleResponse({req:e,nextConfig:x,cacheKey:S,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:$,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:i});if(!k)return null;if((null==p||null==(o=p.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(u=p.value)?void 0:u.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",O?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,f.fromNodeOutgoingHttpHeaders)(p.value.headers);return i&&k||m.delete(g.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,b.getCacheControlHeader)(p.cacheControl)),await (0,c.sendResponse)(K,B,new Response(p.value.body,{headers:m,status:p.value.status||200})),null};V?await u(V):await D.withPropagatedContext(e.headers,()=>D.trace(p.BaseServerSpan.handleRequest,{spanName:`${q} ${h}`,kind:o.SpanKind.SERVER,attributes:{"http.method":q,"http.target":e.url}},u))}catch(t){if(t instanceof m.NoFallbackError||await w.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:O})},!1,E),k)throw t;return await (0,c.sendResponse)(K,B,new Response(null,{status:500})),null}}e.s(["handler",()=>_,"patchFetch",()=>$,"routeModule",()=>w,"serverHooks",()=>O,"workAsyncStorage",()=>C,"workUnitAsyncStorage",()=>E],59462)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=node_modules_next_dist_esm_build_templates_app-route_7e181e75.js.map
|
package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/app/api/opencode-config/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { readConfig, writeConfig } from '@/lib/opencodeConfig';\n\n// Allowed fields to expose in the API\nconst ALLOWED_AGENT_FIELDS = ['model', 'temperature', 'top_p', 'variant', 'prompt_append'] as const;\n\n/**\n * Filters an agent config to only include allowed fields\n */\nfunction filterAgentConfig(agent: Record<string, unknown>): Record<string, unknown> {\n const filtered: Record<string, unknown> = {};\n \n for (const field of ALLOWED_AGENT_FIELDS) {\n if (agent[field] !== undefined) {\n filtered[field] = agent[field];\n }\n }\n \n return filtered;\n}\n\n/**\n * GET /api/opencode-config\n * Returns filtered agent configuration\n * Only exposes: model, temperature, top_p\n * Filters out sensitive fields (apiKey, token, password, etc.)\n */\nexport async function GET() {\n try {\n const config = await readConfig();\n const agents = config.agents || {};\n const filteredAgents: Record<string, Record<string, unknown>> = {};\n \n for (const [agentName, agentConfig] of Object.entries(agents)) {\n if (typeof agentConfig === 'object' && agentConfig !== null) {\n filteredAgents[agentName] = filterAgentConfig(agentConfig as Record<string, unknown>);\n }\n }\n\n const categories = config.categories || {};\n const filteredCategories: Record<string, Record<string, unknown>> = {};\n \n for (const [catName, catConfig] of Object.entries(categories)) {\n if (typeof catConfig === 'object' && catConfig !== null && !Array.isArray(catConfig)) {\n filteredCategories[catName] = filterAgentConfig(catConfig as Record<string, unknown>);\n }\n }\n\n const vibepulse = config.vibepulse && typeof config.vibepulse === 'object' && !Array.isArray(config.vibepulse)\n ? config.vibepulse\n : {};\n\n return NextResponse.json({ \n agents: filteredAgents,\n categories: filteredCategories,\n vibepulse\n });\n } catch (error) {\n console.error('Error reading config:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\n }\n}\n\n/**\n * POST /api/opencode-config\n * Updates agent configuration with validation\n * Only allows: model, temperature, top_p\n * Rejects sensitive fields (apiKey, token, password, secret, etc.)\n */\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json();\n\n // Validate request structure\n if (!body || typeof body !== 'object') {\n return NextResponse.json(\n { error: 'Invalid request body' },\n { status: 400 }\n );\n }\n\n const { agents, categories, vibepulse } = body;\n\n // If neither agents, categories, nor vibepulse provided, nothing to update\n if (agents === undefined && categories === undefined && vibepulse === undefined) {\n return NextResponse.json(\n { error: 'Missing agents, categories, or vibepulse field' },\n { status: 400 }\n );\n }\n\n // Validate agents is an object (if provided)\n if (agents !== undefined && (typeof agents !== 'object' || agents === null || Array.isArray(agents))) {\n return NextResponse.json(\n { error: 'Agents must be an object' },\n { status: 400 }\n );\n }\n \n // Validate categories is an object (if provided)\n if (categories !== undefined && (typeof categories !== 'object' || categories === null || Array.isArray(categories))) {\n return NextResponse.json(\n { error: 'Categories must be an object' },\n { status: 400 }\n );\n }\n\n // Validate vibepulse is an object (if provided)\n if (vibepulse !== undefined && (typeof vibepulse !== 'object' || vibepulse === null || Array.isArray(vibepulse))) {\n return NextResponse.json(\n { error: 'Vibepulse must be an object' },\n { status: 400 }\n );\n }\n\n // Read current config\n const currentConfig = await readConfig();\n const currentAgents = currentConfig.agents || {};\n\n // Validate and merge agent updates\n const updatedAgents: Record<string, Record<string, unknown>> = {};\n\n for (const [name, config] of Object.entries(currentAgents)) {\n if (typeof config === 'object' && config !== null && !Array.isArray(config)) {\n updatedAgents[name] = config as Record<string, unknown>;\n }\n }\n\n if (agents !== undefined) {\n for (const [agentName, agentConfig] of Object.entries(agents)) {\n if (typeof agentConfig !== 'object' || agentConfig === null || Array.isArray(agentConfig)) {\n return NextResponse.json(\n { error: `Agent '${agentName}' config must be an object` },\n { status: 400 }\n );\n }\n\n const config = agentConfig as Record<string, unknown>;\n const disallowedFields: string[] = [];\n\n for (const key of Object.keys(config)) {\n const lowerKey = key.toLowerCase();\n if (\n lowerKey.includes('api') ||\n lowerKey.includes('key') ||\n lowerKey.includes('token') ||\n lowerKey.includes('secret') ||\n lowerKey.includes('password') ||\n lowerKey.includes('auth') ||\n lowerKey.includes('credential') ||\n lowerKey.includes('private') ||\n lowerKey.includes('cert')\n ) {\n disallowedFields.push(key);\n }\n }\n\n if (disallowedFields.length > 0) {\n return NextResponse.json(\n {\n error: `Agent '${agentName}' contains disallowed fields: ${disallowedFields.join(', ')}`\n },\n { status: 403 }\n );\n }\n\n const validatedConfig: Record<string, unknown> = {};\n\n for (const [field, value] of Object.entries(config)) {\n const lowerField = field.toLowerCase();\n\n if (lowerField === 'model') {\n if (typeof value !== 'string' || value.trim() === '') {\n return NextResponse.json(\n { error: `Agent '${agentName}': model must be a non-empty string` },\n { status: 400 }\n );\n }\n validatedConfig[field] = value;\n } else if (lowerField === 'temperature') {\n const temp = Number(value);\n if (isNaN(temp) || temp < 0 || temp > 2) {\n return NextResponse.json(\n { error: `Agent '${agentName}': temperature must be a number between 0 and 2` },\n { status: 400 }\n );\n }\n validatedConfig[field] = temp;\n } else if (lowerField === 'top_p') {\n const topP = Number(value);\n if (isNaN(topP) || topP < 0 || topP > 1) {\n return NextResponse.json(\n { error: `Agent '${agentName}': top_p must be a number between 0 and 1` },\n { status: 400 }\n );\n }\n validatedConfig[field] = topP;\n } else if (lowerField === 'variant') {\n if (typeof value !== 'string') {\n return NextResponse.json(\n { error: `Agent '${agentName}': variant must be a string` },\n { status: 400 }\n );\n }\n validatedConfig[field] = value;\n } else if (lowerField === 'prompt_append') {\n if (typeof value !== 'string') {\n return NextResponse.json(\n { error: `Agent '${agentName}': prompt_append must be a string` },\n { status: 400 }\n );\n }\n validatedConfig[field] = value;\n } else {\n return NextResponse.json(\n {\n error: `Agent '${agentName}': unknown field '${field}'. Allowed fields: model, temperature, top_p, variant, prompt_append`\n },\n { status: 400 }\n );\n }\n }\n\n updatedAgents[agentName] = {\n ...(currentAgents[agentName] as Record<string, unknown> || {}),\n ...validatedConfig\n };\n }\n }\n\n // Process categories updates if provided\n const updatedCategories: Record<string, Record<string, unknown>> = {};\n const currentCategories = (currentConfig.categories || {}) as Record<string, Record<string, unknown>>;\n\n for (const [name, config] of Object.entries(currentCategories)) {\n if (typeof config === 'object' && config !== null && !Array.isArray(config)) {\n updatedCategories[name] = config as Record<string, unknown>;\n }\n }\n\n if (categories !== undefined) {\n for (const [categoryName, categoryConfig] of Object.entries(categories)) {\n if (typeof categoryConfig !== 'object' || categoryConfig === null || Array.isArray(categoryConfig)) {\n return NextResponse.json(\n { error: `Category '${categoryName}' config must be an object` },\n { status: 400 }\n );\n }\n\n const configObj = categoryConfig as Record<string, unknown>;\n const validatedCategoryConfig: Record<string, unknown> = {};\n\n for (const [field, value] of Object.entries(configObj)) {\n if (field === 'model' || field === 'variant' || field === 'prompt_append' || field === 'description') {\n if (value !== undefined && typeof value !== 'string') {\n return NextResponse.json(\n { error: `Category '${categoryName}': '${field}' must be a string` },\n { status: 400 }\n );\n }\n validatedCategoryConfig[field] = value;\n } else if (field === 'temperature' || field === 'top_p') {\n if (value !== undefined && typeof value !== 'number') {\n return NextResponse.json(\n { error: `Category '${categoryName}': '${field}' must be a number` },\n { status: 400 }\n );\n }\n \n const numValue = value as number;\n const temp = field === 'temperature' ? Math.max(0, Math.min(2, numValue)) : numValue;\n const topP = field === 'top_p' ? Math.max(0, Math.min(1, numValue)) : numValue;\n \n validatedCategoryConfig[field] = field === 'temperature' ? temp : topP;\n } else {\n return NextResponse.json(\n { error: `Category '${categoryName}': unknown field '${field}'` },\n { status: 400 }\n );\n }\n }\n \n updatedCategories[categoryName] = {\n ...((currentCategories[categoryName] as Record<string, unknown>) || {}),\n ...validatedCategoryConfig\n };\n }\n }\n\n // Process vibepulse updates if provided\n const updatedVibepulse: Record<string, unknown> = {};\n const currentVibepulse = (currentConfig.vibepulse && typeof currentConfig.vibepulse === 'object' && !Array.isArray(currentConfig.vibepulse))\n ? (currentConfig.vibepulse as Record<string, unknown>)\n : {};\n\n if (vibepulse !== undefined) {\n for (const [key, value] of Object.entries(currentVibepulse)) {\n updatedVibepulse[key] = value;\n }\n \n for (const [field, value] of Object.entries(vibepulse as Record<string, unknown>)) {\n if (field === 'stickyBusyDelayMs' || field === 'sessionsRefreshIntervalMs') {\n if (value !== undefined && typeof value !== 'number') {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be a number` },\n { status: 400 }\n );\n }\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be a finite number` },\n { status: 400 }\n );\n }\n\n if (field === 'stickyBusyDelayMs' && value < 0) {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be a non-negative number` },\n { status: 400 }\n );\n }\n\n if (field === 'sessionsRefreshIntervalMs' && value <= 0) {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be greater than 0` },\n { status: 400 }\n );\n }\n\n updatedVibepulse[field] = value;\n }\n } else {\n return NextResponse.json(\n { error: `Vibepulse: unknown field '${field}'` },\n { status: 400 }\n );\n }\n }\n }\n\n // Update config and save\n const newConfig = { ...currentConfig } as Record<string, unknown>;\n if (agents !== undefined) newConfig.agents = updatedAgents;\n if (categories !== undefined) newConfig.categories = updatedCategories;\n if (vibepulse !== undefined) newConfig.vibepulse = updatedVibepulse;\n \n // writeConfig type doesn't natively expose categories yet, safely bypassing\n await writeConfig(\n newConfig as { \n agents?: Record<string, Record<string, unknown>>; \n categories?: Record<string, Record<string, unknown>>; \n vibepulse?: Record<string, unknown>;\n }\n );\n\n return NextResponse.json(\n { success: true, agents: updatedAgents, categories: updatedCategories, vibepulse: updatedVibepulse },\n { status: 200 }\n );\n} catch (error) {\n console.error('Error updating config:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\n}\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/opencode-config/route\",\n pathname: \"/api/opencode-config\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/opencode-config/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/opencode-config/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"uCCAA,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,OAGA,IAAM,EAAuB,CAAC,QAAS,cAAe,QAAS,UAAW,gBAAgB,CAK1F,SAAS,EAAkB,CAA8B,EACvD,IAAM,EAAoC,CAAC,EAE3C,IAAK,IAAM,KAAS,OACG,IAAjB,CAAK,CAAC,EAAM,GACd,AAD8B,CACtB,CAAC,CAF6B,CAEvB,CAAG,CAAK,CAAC,EAAA,AAAM,EAIlC,OAAO,CACT,CAQO,eAAe,IACpB,GAAI,CACF,IAAM,EAAS,MAAM,CAAA,EAAA,EAAA,UAAA,AAAU,IACzB,EAAS,EAAO,MAAM,EAAI,CAAC,EAC3B,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uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[1]}
|
|
1
|
+
{"version":3,"sources":["../../../src/app/api/opencode-config/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { normalizeVibePulseConfig, readConfig, writeConfig } from '@/lib/opencodeConfig';\n\n// Allowed fields to expose in the API\nconst ALLOWED_AGENT_FIELDS = ['model', 'temperature', 'top_p', 'variant', 'prompt_append'] as const;\n\n/**\n * Filters an agent config to only include allowed fields\n */\nfunction filterAgentConfig(agent: Record<string, unknown>): Record<string, unknown> {\n const filtered: Record<string, unknown> = {};\n \n for (const field of ALLOWED_AGENT_FIELDS) {\n if (agent[field] !== undefined) {\n filtered[field] = agent[field];\n }\n }\n \n return filtered;\n}\n\n/**\n * GET /api/opencode-config\n * Returns filtered agent configuration\n * Only exposes: model, temperature, top_p\n * Filters out sensitive fields (apiKey, token, password, etc.)\n */\nexport async function GET() {\n try {\n const config = await readConfig();\n const agents = config.agents || {};\n const filteredAgents: Record<string, Record<string, unknown>> = {};\n \n for (const [agentName, agentConfig] of Object.entries(agents)) {\n if (typeof agentConfig === 'object' && agentConfig !== null) {\n filteredAgents[agentName] = filterAgentConfig(agentConfig as Record<string, unknown>);\n }\n }\n\n const categories = config.categories || {};\n const filteredCategories: Record<string, Record<string, unknown>> = {};\n \n for (const [catName, catConfig] of Object.entries(categories)) {\n if (typeof catConfig === 'object' && catConfig !== null && !Array.isArray(catConfig)) {\n filteredCategories[catName] = filterAgentConfig(catConfig as Record<string, unknown>);\n }\n }\n\n const vibepulse = normalizeVibePulseConfig(config.vibepulse);\n\n return NextResponse.json({ \n agents: filteredAgents,\n categories: filteredCategories,\n vibepulse\n });\n } catch (error) {\n console.error('Error reading config:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\n }\n}\n\n/**\n * POST /api/opencode-config\n * Updates agent configuration with validation\n * Only allows: model, temperature, top_p\n * Rejects sensitive fields (apiKey, token, password, secret, etc.)\n */\nexport async function POST(request: NextRequest) {\n try {\n const body = await request.json();\n\n // Validate request structure\n if (!body || typeof body !== 'object') {\n return NextResponse.json(\n { error: 'Invalid request body' },\n { status: 400 }\n );\n }\n\n const { agents, categories, vibepulse } = body;\n\n // If neither agents, categories, nor vibepulse provided, nothing to update\n if (agents === undefined && categories === undefined && vibepulse === undefined) {\n return NextResponse.json(\n { error: 'Missing agents, categories, or vibepulse field' },\n { status: 400 }\n );\n }\n\n // Validate agents is an object (if provided)\n if (agents !== undefined && (typeof agents !== 'object' || agents === null || Array.isArray(agents))) {\n return NextResponse.json(\n { error: 'Agents must be an object' },\n { status: 400 }\n );\n }\n \n // Validate categories is an object (if provided)\n if (categories !== undefined && (typeof categories !== 'object' || categories === null || Array.isArray(categories))) {\n return NextResponse.json(\n { error: 'Categories must be an object' },\n { status: 400 }\n );\n }\n\n // Validate vibepulse is an object (if provided)\n if (vibepulse !== undefined && (typeof vibepulse !== 'object' || vibepulse === null || Array.isArray(vibepulse))) {\n return NextResponse.json(\n { error: 'Vibepulse must be an object' },\n { status: 400 }\n );\n }\n\n // Read current config\n const currentConfig = await readConfig();\n const currentAgents = currentConfig.agents || {};\n\n // Validate and merge agent updates\n const updatedAgents: Record<string, Record<string, unknown>> = {};\n\n for (const [name, config] of Object.entries(currentAgents)) {\n if (typeof config === 'object' && config !== null && !Array.isArray(config)) {\n updatedAgents[name] = config as Record<string, unknown>;\n }\n }\n\n if (agents !== undefined) {\n for (const [agentName, agentConfig] of Object.entries(agents)) {\n if (typeof agentConfig !== 'object' || agentConfig === null || Array.isArray(agentConfig)) {\n return NextResponse.json(\n { error: `Agent '${agentName}' config must be an object` },\n { status: 400 }\n );\n }\n\n const config = agentConfig as Record<string, unknown>;\n const disallowedFields: string[] = [];\n\n for (const key of Object.keys(config)) {\n const lowerKey = key.toLowerCase();\n if (\n lowerKey.includes('api') ||\n lowerKey.includes('key') ||\n lowerKey.includes('token') ||\n lowerKey.includes('secret') ||\n lowerKey.includes('password') ||\n lowerKey.includes('auth') ||\n lowerKey.includes('credential') ||\n lowerKey.includes('private') ||\n lowerKey.includes('cert')\n ) {\n disallowedFields.push(key);\n }\n }\n\n if (disallowedFields.length > 0) {\n return NextResponse.json(\n {\n error: `Agent '${agentName}' contains disallowed fields: ${disallowedFields.join(', ')}`\n },\n { status: 403 }\n );\n }\n\n const validatedConfig: Record<string, unknown> = {};\n\n for (const [field, value] of Object.entries(config)) {\n const lowerField = field.toLowerCase();\n\n if (lowerField === 'model') {\n if (typeof value !== 'string' || value.trim() === '') {\n return NextResponse.json(\n { error: `Agent '${agentName}': model must be a non-empty string` },\n { status: 400 }\n );\n }\n validatedConfig[field] = value;\n } else if (lowerField === 'temperature') {\n const temp = Number(value);\n if (isNaN(temp) || temp < 0 || temp > 2) {\n return NextResponse.json(\n { error: `Agent '${agentName}': temperature must be a number between 0 and 2` },\n { status: 400 }\n );\n }\n validatedConfig[field] = temp;\n } else if (lowerField === 'top_p') {\n const topP = Number(value);\n if (isNaN(topP) || topP < 0 || topP > 1) {\n return NextResponse.json(\n { error: `Agent '${agentName}': top_p must be a number between 0 and 1` },\n { status: 400 }\n );\n }\n validatedConfig[field] = topP;\n } else if (lowerField === 'variant') {\n if (typeof value !== 'string') {\n return NextResponse.json(\n { error: `Agent '${agentName}': variant must be a string` },\n { status: 400 }\n );\n }\n validatedConfig[field] = value;\n } else if (lowerField === 'prompt_append') {\n if (typeof value !== 'string') {\n return NextResponse.json(\n { error: `Agent '${agentName}': prompt_append must be a string` },\n { status: 400 }\n );\n }\n validatedConfig[field] = value;\n } else {\n return NextResponse.json(\n {\n error: `Agent '${agentName}': unknown field '${field}'. Allowed fields: model, temperature, top_p, variant, prompt_append`\n },\n { status: 400 }\n );\n }\n }\n\n updatedAgents[agentName] = {\n ...(currentAgents[agentName] as Record<string, unknown> || {}),\n ...validatedConfig\n };\n }\n }\n\n // Process categories updates if provided\n const updatedCategories: Record<string, Record<string, unknown>> = {};\n const currentCategories = (currentConfig.categories || {}) as Record<string, Record<string, unknown>>;\n\n for (const [name, config] of Object.entries(currentCategories)) {\n if (typeof config === 'object' && config !== null && !Array.isArray(config)) {\n updatedCategories[name] = config as Record<string, unknown>;\n }\n }\n\n if (categories !== undefined) {\n for (const [categoryName, categoryConfig] of Object.entries(categories)) {\n if (typeof categoryConfig !== 'object' || categoryConfig === null || Array.isArray(categoryConfig)) {\n return NextResponse.json(\n { error: `Category '${categoryName}' config must be an object` },\n { status: 400 }\n );\n }\n\n const configObj = categoryConfig as Record<string, unknown>;\n const validatedCategoryConfig: Record<string, unknown> = {};\n\n for (const [field, value] of Object.entries(configObj)) {\n if (field === 'model' || field === 'variant' || field === 'prompt_append' || field === 'description') {\n if (value !== undefined && typeof value !== 'string') {\n return NextResponse.json(\n { error: `Category '${categoryName}': '${field}' must be a string` },\n { status: 400 }\n );\n }\n validatedCategoryConfig[field] = value;\n } else if (field === 'temperature' || field === 'top_p') {\n if (value !== undefined && typeof value !== 'number') {\n return NextResponse.json(\n { error: `Category '${categoryName}': '${field}' must be a number` },\n { status: 400 }\n );\n }\n \n const numValue = value as number;\n const temp = field === 'temperature' ? Math.max(0, Math.min(2, numValue)) : numValue;\n const topP = field === 'top_p' ? Math.max(0, Math.min(1, numValue)) : numValue;\n \n validatedCategoryConfig[field] = field === 'temperature' ? temp : topP;\n } else {\n return NextResponse.json(\n { error: `Category '${categoryName}': unknown field '${field}'` },\n { status: 400 }\n );\n }\n }\n \n updatedCategories[categoryName] = {\n ...((currentCategories[categoryName] as Record<string, unknown>) || {}),\n ...validatedCategoryConfig\n };\n }\n }\n\n // Process vibepulse updates if provided\n const updatedVibepulse: Record<string, unknown> = {};\n const currentVibepulse = normalizeVibePulseConfig(currentConfig.vibepulse);\n\n if (vibepulse !== undefined) {\n for (const [key, value] of Object.entries(currentVibepulse)) {\n updatedVibepulse[key] = value;\n }\n \n for (const [field, value] of Object.entries(vibepulse as Record<string, unknown>)) {\n if (field === 'stickyBusyDelayMs' || field === 'sessionsRefreshIntervalMs') {\n if (value !== undefined && typeof value !== 'number') {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be a number` },\n { status: 400 }\n );\n }\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be a finite number` },\n { status: 400 }\n );\n }\n\n if (field === 'stickyBusyDelayMs' && value < 0) {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be a non-negative number` },\n { status: 400 }\n );\n }\n\n if (field === 'sessionsRefreshIntervalMs' && value <= 0) {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be greater than 0` },\n { status: 400 }\n );\n }\n\n updatedVibepulse[field] = value;\n }\n } else if (field === 'openEditorTargetMode') {\n if (value !== 'remote' && value !== 'hub') {\n return NextResponse.json(\n { error: `Vibepulse: '${field}' must be either 'remote' or 'hub'` },\n { status: 400 }\n );\n }\n\n updatedVibepulse[field] = value;\n } else {\n return NextResponse.json(\n { error: `Vibepulse: unknown field '${field}'` },\n { status: 400 }\n );\n }\n }\n }\n\n // Update config and save\n const newConfig = { ...currentConfig } as Record<string, unknown>;\n if (agents !== undefined) newConfig.agents = updatedAgents;\n if (categories !== undefined) newConfig.categories = updatedCategories;\n if (vibepulse !== undefined) newConfig.vibepulse = updatedVibepulse;\n \n // writeConfig type doesn't natively expose categories yet, safely bypassing\n await writeConfig(\n newConfig as { \n agents?: Record<string, Record<string, unknown>>; \n categories?: Record<string, Record<string, unknown>>; \n vibepulse?: Record<string, unknown>;\n }\n );\n\n return NextResponse.json(\n { success: true, agents: updatedAgents, categories: updatedCategories, vibepulse: updatedVibepulse },\n { status: 200 }\n );\n} catch (error) {\n console.error('Error updating config:', error);\n return NextResponse.json(\n { error: 'Internal server error' },\n { status: 500 }\n );\n}\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"standalone\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/opencode-config/route\",\n pathname: \"/api/opencode-config\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/opencode-config/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/opencode-config/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.experimental.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const isMinimalMode = Boolean(process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode'));\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"u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AEA,qCAAqC","ignoreList":[1]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[92777,e=>{"use strict";var t=e.i(47909),r=e.i(74017),i=e.i(96250),a=e.i(59756),n=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),f=e.i(26937),m=e.i(10372),g=e.i(93695);e.i(52474);var y=e.i(220);e.i(39354);var S=e.i(34959),v=e.i(33405),w=e.i(14747),b=e.i(99686),R=e.i(57181),I=e.i(586),E=e.i(68817),T=e.i(74579);let C=D("OPENCODE_SESSIONS_LIST_TIMEOUT_MS",6e3),_=D("OPENCODE_SESSIONS_STATUS_TIMEOUT_MS",4e3),O=D("OPENCODE_SESSIONS_MESSAGES_TIMEOUT_MS",2500),A={hostId:"local",hostLabel:"Local",hostKind:"local"},U=new Map,N=new Set(["awaiting-input","awaiting_input","input-required","input_required","requires-input","requires_input","blocked","paused"]);async function P(e){let t=(0,E.guardNodeRequest)(e);if(!t.ok)return(0,E.toNodeRequestGuardResponse)(t);let r=await B(),i=await z(r);if(!i.ok)return(0,E.createNodeFailureResponse)(i.reason,i.extras);let a=G(i.meta),n={ok:!0,role:"node",protocolVersion:E.NODE_PROTOCOL_VERSION,source:A,upstream:{kind:"opencode",reachable:!0},sessions:i.payload.sessions.map(e=>{var t;let r,i;return r=(t=e).rawSessionId??t.id,i=(0,I.composeSourceKey)(A.hostId,r),{...t,id:i,parentID:t.parentID?(0,I.composeSourceKey)(A.hostId,t.parentID):t.parentID,hostId:A.hostId,hostLabel:A.hostLabel,hostKind:A.hostKind,rawSessionId:r,sourceSessionKey:i,readOnly:!1,children:t.children.map(e=>{let t,r;return t=e.rawSessionId??e.id,r=(0,I.composeSourceKey)(A.hostId,t),{...e,id:r,parentID:e.parentID?(0,I.composeSourceKey)(A.hostId,e.parentID):e.parentID,hostId:A.hostId,hostLabel:A.hostLabel,hostKind:A.hostKind,rawSessionId:t,sourceSessionKey:r,readOnly:!1}})}}),processHints:i.payload.processHints,hosts:[a],hostStatuses:[a],...i.payload.failedPorts?{failedPorts:i.payload.failedPorts}:{},...i.payload.degraded?{degraded:!0}:{}};return Response.json(n)}function D(e,t){let r=Number(process.env[e]);return Number.isFinite(r)&&r>0?Math.floor(r):t}function F(e,t,r){let i,a=Error(`${r} timed out after ${t}ms`),n=new AbortController,s=new Promise((e,r)=>{i=setTimeout(()=>{n.abort(),r(a)},t)});return Promise.race([e(n.signal).catch(e=>{if(n.signal.aborted)throw a;throw e}),s]).finally(()=>{i&&clearTimeout(i)})}function x(e){return e.trim().toLowerCase()}function k(e){return N.has(x(e))}async function M(e,t,r){var i=(await F(r=>e.session.messages({path:{id:t},query:{limit:8},signal:r}),r,`session.messages(${t})`)).data||[];let a=[];for(let e of i)for(let t of e.parts||[]){let e=t?.state?.status;if("string"==typeof e){let t=x(e);t&&a.push(t)}}return a}function q(e){return e.time?.updated||e.time?.created||0}function H(e){return"busy"===e||"retry"===e?e:"idle"}function K(e){U.delete(e),U.delete(`child:${e}`)}function $(e,t,r,i){let a=U.get(e)??{lastBusyAt:0,lastSeenAt:r};if("busy"===t)return a.lastBusyAt=r,a.lastSeenAt=r,U.set(e,a),t;if("retry"===t)return a.lastSeenAt=r,U.set(e,a),t;let n=a.lastBusyAt>0&&r-a.lastBusyAt<=i;return a.lastSeenAt=r,U.set(e,a),n?"busy":"idle"}function L(e,t){let r;for(let[r,i]of U){let a=e-i.lastSeenAt,n=t.has(r);(a>864e5||!n&&a>18e5)&&U.delete(r)}let i=Number.isFinite(r=Number(process.env.OPENCODE_STATUS_STICKY_MAX_ENTRIES))&&r>0?Math.floor(r):5e3;if(U.size<=i)return;let a=U.size-i,n=Array.from(U.entries()).sort((e,t)=>e[1].lastSeenAt-t[1].lastSeenAt),s=0;for(let[e]of n){if(s>=a)break;!t.has(e)&&(U.delete(e),s++)}if(!(s>=a))for(let[e]of n){if(s>=a)break;U.has(e)&&(U.delete(e),s++)}}function W(e,t,r=!1){return{id:e.id,slug:e.slug,title:e.title,directory:e.directory,debugReason:e.debugReason,parentID:e.parentID,time:e.time,realTimeStatus:t,waitingForUser:r}}function j(e){return w.default.basename(e)}async function B(){let e=1e3;try{let t=await (0,R.readConfig)(),r=(t.vibepulse&&"object"==typeof t.vibepulse&&!Array.isArray(t.vibepulse)?t.vibepulse:{}).stickyBusyDelayMs;"number"==typeof r&&Number.isFinite(r)&&r>=0&&(e=r)}catch{}return e}function G(e){return{hostId:A.hostId,hostLabel:A.hostLabel,hostKind:A.hostKind,online:e.online,...e.degraded?{degraded:!0}:{},...e.reason?{reason:e.reason}:{}}}function V(e){return e.toLowerCase().includes("timed out")}function X(e,t,r={}){let i="upstream_timeout"===e?{statusReason:"OpenCode discovery timed out",reachable:!1}:{statusReason:"OpenCode server not found",reachable:!1},a=G({online:!1,degraded:!0,reason:i.statusReason});return{ok:!1,reason:e,extras:{role:"node",source:A,upstream:{kind:"opencode",reachable:i.reachable},processHints:t,hosts:[a],hostStatuses:[a],...r}}}async function z(e){let{processes:t,timedOut:r}=(0,b.discoverOpencodeProcessCwdsWithoutPortWithMeta)(),i=new Map;for(let e of t)!(!e.cwd||e.cwd.startsWith("/private/tmp/opencode"))&&(i.has(e.cwd)||i.set(e.cwd,{pid:e.pid,directory:e.cwd,projectName:j(e.cwd),reason:"process_without_api_port"}));let a=Array.from(i.values()),{ports:n,timedOut:s}=(0,b.discoverOpencodePortsWithMeta)();if(!n.length)return s||r?X("upstream_timeout",a):X("upstream_unreachable",a);try{var o;let t=await Promise.allSettled(n.map(async e=>{let t=(0,S.createOpencodeClient)({baseUrl:`http://localhost:${e}`}),r=await F(e=>t.session.list({signal:e}),C,`session.list(${e})`),i=await F(e=>t.session.status({signal:e}),_,`session.status(${e})`).catch(()=>({data:{}}));return{port:e,client:t,sessions:r.data||[],status:i.data||{}}})),r=[],i={},s={},l={},d=[];for(let e=0;e<t.length;e++){let a=t[e],o=n[e];if("fulfilled"!==a.status){d.push({port:o,reason:a.reason instanceof Error?a.reason.message:String(a.reason)});continue}for(let e of(r.push(...a.value.sessions),Object.assign(i,a.value.status),s[a.value.port]=a.value.client,a.value.sessions))e.id in l||(l[e.id]=a.value.port)}let u=[],c=new Set;for(let e of r)c.has(e.id)||(c.add(e.id),u.push(e));let p=u.filter(e=>!e.parentID),h=u.filter(e=>!!e.parentID),f=Date.now();for(let e of((0,T.pruneSessionForceUnarchived)(f),(0,T.pruneSessionStickyStatusBlocked)(f),p))e.time?.archived!==void 0&&(0,T.shouldForceSessionUnarchived)(e.id,f)&&(e.time={...e.time,archived:void 0});for(let e of h)e.time?.archived!==void 0&&(0,T.shouldForceSessionUnarchived)(e.id,f)&&(e.time={...e.time,archived:void 0});if(t.length>0&&d.length===t.length)return L(Date.now(),new Set),X((o=d.map(e=>e.reason)).length>0&&o.every(V)?"upstream_timeout":"upstream_unreachable",a,{failedPorts:d});let m=p.map(e=>({...e,projectName:j(e.directory),branch:function(e){if(!function(e){try{let t=(0,v.execSync)("git rev-parse --is-inside-work-tree",{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:1200});return"true"===t.trim()}catch{return!1}}(e))return null;try{return(0,v.execSync)("git branch --show-current",{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:1200}).trim()||null}catch{return null}}(e.directory),realTimeStatus:i[e.id]?.type||"idle",waitingForUser:!1,children:[]})),g=new Map(m.map(e=>[e.id,e])),y=Date.now(),w=[];for(let e of h){let t=e.parentID?g.get(e.parentID):void 0;if(!t){let r=m.filter(t=>t.directory===e.directory).sort((e,t)=>q(t)-q(e));t=r.find(e=>"busy"===e.realTimeStatus||"retry"===e.realTimeStatus)||r[0]}if(!t)continue;let r=i[e.id]?.type,a=q(e),n=a>0&&y-a<=18e5;!(e.time?.archived&&!r&&!n)&&(r&&"idle"!==r?t.children.push(W(e,r)):n&&w.length<50&&w.push({parentId:t.id,child:e,childUpdatedAt:a}))}if(w.length>0)for(let e of(await Promise.allSettled(w.map(async({parentId:e,child:t,childUpdatedAt:r})=>{let i=l[t.id]??l[e],a=i?s[i]:void 0,n=r>0&&y-r<=12e4;if(!a)return{parentId:e,child:t,childStatus:n?"busy":"idle"};try{let i=await M(a,t.id,O),s=i.some(e=>"running"===e),o=!s&&i.some(k);return{parentId:e,child:t,childWaitingForUser:o,childStatus:o||s||r>0&&y-r<=3e5||n?"busy":"idle"}}catch{return{parentId:e,child:t,childWaitingForUser:!1,childStatus:n?"busy":"idle"}}})))){if("fulfilled"!==e.status||"idle"===e.value.childStatus)continue;let t=g.get(e.value.parentId);t&&t.children.push(W(e.value.child,e.value.childStatus,e.value.childWaitingForUser))}let b=m.filter(e=>{if("idle"!==e.realTimeStatus)return!1;let t=q(e);return t>0&&y-t<=18e5||!!e.time?.archived}).sort((e,t)=>q(t)-q(e)).slice(0,50);if(b.length>0)for(let e of(await Promise.allSettled(b.map(async e=>{let t=q(e),r=t>0&&y-t<=12e4,i=l[e.id],a=i?s[i]:void 0;if(!a)return{sessionId:e.id,status:r?"busy":"idle",waitingForUser:!1};try{let t,i=await M(a,e.id,O),n=i.some(e=>"running"===e),s=!n&&i.some(k),o=i.length>0&&i.every(e=>"completed"===e),l=!!(t=e.time?.updated)&&y-t<=3e4;return{sessionId:e.id,status:n||s?"busy":o&&!l?"idle":r||l?"busy":"idle",waitingForUser:s}}catch{return{sessionId:e.id,status:r?"busy":"idle",waitingForUser:!1}}})))){if("fulfilled"!==e.status||"idle"===e.value.status)continue;let t=g.get(e.value.sessionId);t&&(t.realTimeStatus=e.value.status,e.value.waitingForUser&&(t.waitingForUser=!0))}for(let e of m)e.children.length>0&&e.children.sort((e,t)=>{let r="busy"===e.realTimeStatus||"retry"===e.realTimeStatus,i="busy"===t.realTimeStatus||"retry"===t.realTimeStatus;if(r&&!i)return -1;if(!r&&i)return 1;let a=e.time?.updated||e.time?.created||0;return(t.time?.updated||t.time?.created||0)-a});let R=m.filter(e=>"busy"===e.realTimeStatus||!!e.time?.archived||e.children.some(e=>"busy"===e.realTimeStatus||"retry"===e.realTimeStatus));if(R.length>0)for(let e of(await Promise.allSettled(R.map(async e=>{let t=l[e.id],r=t?s[t]:void 0;if(!r)return{sessionId:e.id,parentWaiting:!1,running:!1,waitingChildIds:new Set};try{let t=await M(r,e.id,O),i=t.some(e=>"running"===e),a=!i&&t.some(k),n=await Promise.allSettled(e.children.filter(e=>"busy"===e.realTimeStatus||"retry"===e.realTimeStatus).map(async t=>{let r=l[t.id]??l[e.id],i=r?s[r]:void 0;if(!i)return{childId:t.id,waiting:!1};try{let e=await M(i,t.id,O),r=e.some(e=>"running"===e);return{childId:t.id,waiting:!r&&e.some(k)}}catch{return{childId:t.id,waiting:!1}}})),o=new Set(n.filter(e=>"fulfilled"===e.status).filter(e=>e.value.waiting).map(e=>e.value.childId));return{sessionId:e.id,parentWaiting:a,running:i,waitingChildIds:o}}catch{return{sessionId:e.id,parentWaiting:!1,running:!1,waitingChildIds:new Set}}})))){if("fulfilled"!==e.status)continue;let t=m.find(t=>t.id===e.value.sessionId);if(t){for(let r of t.children)e.value.waitingChildIds.has(r.id)&&(r.waitingForUser=!0);e.value.running&&(t.realTimeStatus="busy"),e.value.parentWaiting&&(t.waitingForUser=!0)}}let I=Date.now(),E=new Set;for(let e of m)for(let t of(E.add(e.id),e.children))E.add(`child:${t.id}`);for(let t of m)(!((0,T.takeSessionStickyStatusBlocked)(t.id,I)||t.time?.archived)||(function(e){for(let t of(K(e.id),(0,T.clearSessionForceUnarchived)(e.id),e.children))K(`child:${t.id}`),(0,T.clearSessionForceUnarchived)(t.id)}(t),0))&&function(e,t,r){for(let i of e.children){if(i.time?.archived){K(`child:${i.id}`),(0,T.clearSessionForceUnarchived)(i.id);continue}let e=H(i.realTimeStatus),a=i.waitingForUser&&"idle"===e?"retry":e;i.realTimeStatus=$(`child:${i.id}`,a,t,r),("busy"===i.realTimeStatus||"retry"===i.realTimeStatus||i.waitingForUser)&&(0,T.markSessionForceUnarchived)(i.id,t)}let i=H(e.realTimeStatus),a=e.waitingForUser&&"idle"===i?"retry":i;e.realTimeStatus=$(e.id,a,t,r);let n=e.children.some(e=>"busy"===e.realTimeStatus||"retry"===e.realTimeStatus||e.waitingForUser);("busy"===e.realTimeStatus||"retry"===e.realTimeStatus||e.waitingForUser||n)&&(0,T.markSessionForceUnarchived)(e.id,t)}(t,I,e);L(I,E);let A=new Set;for(let e of u)e.directory&&A.add(e.directory);let U=a.filter(e=>!A.has(e.directory));return{ok:!0,payload:{sessions:m,processHints:U,...d.length>0?{failedPorts:d,degraded:!0}:{}},meta:{online:!0,...d.length>0?{degraded:!0}:{}}}}catch(e){return console.error("Error fetching node-local sessions:",e),X(e instanceof Error&&V(e.message)?"upstream_timeout":"upstream_unreachable",a,{details:e instanceof Error?e.message:String(e)})}}e.s(["GET",()=>P,"dynamic",0,"force-dynamic"],87009);var Y=e.i(87009);let Z=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/node/sessions/route",pathname:"/api/node/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/node/sessions/route.ts",nextConfigOutput:"standalone",userland:Y}),{workAsyncStorage:J,workUnitAsyncStorage:Q,serverHooks:ee}=Z;function et(){return(0,i.patchFetch)({workAsyncStorage:J,workUnitAsyncStorage:Q})}async function er(e,t,i){Z.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let S="/api/node/sessions/route";S=S.replace(/\/index$/,"")||"/";let v=await Z.prepare(e,t,{srcPage:S,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve()),null;let{buildId:w,params:b,nextConfig:R,parsedUrl:I,isDraftMode:E,prerenderManifest:T,routerServerContext:C,isOnDemandRevalidate:_,revalidateOnlyGenerated:O,resolvedPathname:A,clientReferenceManifest:U,serverActionsManifest:N}=v,P=(0,o.normalizeAppPath)(S),D=!!(T.dynamicRoutes[P]||T.routes[A]),F=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,I,!1):t.end("This page could not be found"),null);if(D&&!E){let e=!!T.routes[A],t=T.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(R.experimental.adapterPath)return await F();throw new g.NoFallbackError}}let x=null;!D||Z.isDev||E||(x="/index"===(x=A)?"/":x);let k=!0===Z.isDev||!D,M=D&&!k;N&&U&&(0,s.setManifestsSingleton)({page:S,clientReferenceManifest:U,serverActionsManifest:N});let q=e.method||"GET",H=(0,n.getTracer)(),K=H.getActiveScopeSpan(),$={params:b,prerenderManifest:T,renderOpts:{experimental:{authInterrupts:!!R.experimental.authInterrupts},cacheComponents:!!R.cacheComponents,supportsDynamicResponse:k,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:R.cacheLife,waitUntil:i.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,i,a)=>Z.onRequestError(e,t,i,a,C)},sharedContext:{buildId:w}},L=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),j=d.NextRequestAdapter.fromNodeNextRequest(L,(0,d.signalFromNodeResponse)(t));try{let s=async e=>Z.handle(j,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=H.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let i=r.get("next.route");if(i){let t=`${q} ${i}`;e.setAttributes({"next.route":i,"http.route":i,"next.span_name":t}),e.updateName(t)}else e.updateName(`${q} ${S}`)}),o=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var n,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&_&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await s(a);e.fetchMetrics=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&i.waitUntil&&(i.waitUntil(l),l=void 0);let d=$.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(L,W,n,$.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);d&&(t[m.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,i=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:i}}}}catch(t){throw(null==r?void 0:r.isStale)&&await Z.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:_})},!1,C),t}},u=await Z.handleResponse({req:e,nextConfig:R,cacheKey:x,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:_,revalidateOnlyGenerated:O,responseGenerator:d,waitUntil:i.waitUntil,isMinimalMode:o});if(!D)return null;if((null==u||null==(n=u.value)?void 0:n.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(l=u.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",_?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),E&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let g=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&D||g.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||g.get("Cache-Control")||g.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(L,W,new Response(u.value.body,{headers:g,status:u.value.status||200})),null};K?await l(K):await H.withPropagatedContext(e.headers,()=>H.trace(u.BaseServerSpan.handleRequest,{spanName:`${q} ${S}`,kind:n.SpanKind.SERVER,attributes:{"http.method":q,"http.target":e.url}},l))}catch(t){if(t instanceof g.NoFallbackError||await Z.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:_})},!1,C),D)throw t;return await (0,p.sendResponse)(L,W,new Response(null,{status:500})),null}}e.s(["handler",()=>er,"patchFetch",()=>et,"routeModule",()=>Z,"serverHooks",()=>ee,"workAsyncStorage",()=>J,"workUnitAsyncStorage",()=>Q],92777)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=node_modules_next_dist_esm_build_templates_app-route_aca45402.js.map
|