@drewsepsi/nextpi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -0
- package/.next/app-path-routes-manifest.json +13 -0
- package/.next/build/chunks/33f32_323ea524._.js +6766 -0
- package/.next/build/chunks/33f32_323ea524._.js.map +47 -0
- package/.next/build/chunks/[root-of-the-server]__6ead02f9._.js +500 -0
- package/.next/build/chunks/[root-of-the-server]__6ead02f9._.js.map +11 -0
- package/.next/build/chunks/[root-of-the-server]__777e9116._.js +206 -0
- package/.next/build/chunks/[root-of-the-server]__777e9116._.js.map +8 -0
- package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_597188b4._.js +13 -0
- package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_597188b4._.js.map +5 -0
- package/.next/build/chunks/[turbopack]_runtime.js +795 -0
- package/.next/build/chunks/[turbopack]_runtime.js.map +10 -0
- package/.next/build/package.json +1 -0
- package/.next/build/postcss.js +6 -0
- package/.next/build/postcss.js.map +5 -0
- package/.next/build-manifest.json +19 -0
- package/.next/cache/.previewinfo +1 -0
- package/.next/cache/.rscinfo +1 -0
- package/.next/cache/.tsbuildinfo +1 -0
- package/.next/diagnostics/build-diagnostics.json +6 -0
- package/.next/diagnostics/framework.json +1 -0
- package/.next/export-marker.json +6 -0
- package/.next/fallback-build-manifest.json +12 -0
- package/.next/images-manifest.json +67 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +114 -0
- package/.next/required-server-files.js +324 -0
- package/.next/required-server-files.json +324 -0
- package/.next/routes-manifest.json +113 -0
- package/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
- package/.next/server/app/_global-error/page/build-manifest.json +16 -0
- package/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
- package/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
- package/.next/server/app/_global-error/page.js +11 -0
- package/.next/server/app/_global-error/page.js.map +5 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/.next/server/app/_global-error/page_client-reference-manifest.js +2 -0
- package/.next/server/app/_global-error.html +2 -0
- package/.next/server/app/_global-error.meta +15 -0
- package/.next/server/app/_global-error.rsc +13 -0
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_global-error.segments/_full.segment.rsc +13 -0
- package/.next/server/app/_global-error.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_global-error.segments/_index.segment.rsc +4 -0
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
- package/.next/server/app/_not-found/page/build-manifest.json +16 -0
- package/.next/server/app/_not-found/page/next-font-manifest.json +11 -0
- package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
- package/.next/server/app/_not-found/page.js +14 -0
- package/.next/server/app/_not-found/page.js.map +5 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +2 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +16 -0
- package/.next/server/app/_not-found.rsc +15 -0
- package/.next/server/app/_not-found.segments/_full.segment.rsc +15 -0
- package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_index.segment.rsc +6 -0
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +4 -0
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
- package/.next/server/app/api/chat/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/chat/route/build-manifest.json +11 -0
- package/.next/server/app/api/chat/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/chat/route.js +7 -0
- package/.next/server/app/api/chat/route.js.map +5 -0
- package/.next/server/app/api/chat/route.js.nft.json +1 -0
- package/.next/server/app/api/chat/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/config/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/config/route/build-manifest.json +11 -0
- package/.next/server/app/api/config/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/config/route.js +7 -0
- package/.next/server/app/api/config/route.js.map +5 -0
- package/.next/server/app/api/config/route.js.nft.json +1 -0
- package/.next/server/app/api/config/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/files/[...path]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/files/[...path]/route/build-manifest.json +11 -0
- package/.next/server/app/api/files/[...path]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/files/[...path]/route.js +7 -0
- package/.next/server/app/api/files/[...path]/route.js.map +5 -0
- package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/files/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/files/route/build-manifest.json +11 -0
- package/.next/server/app/api/files/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/files/route.js +7 -0
- package/.next/server/app/api/files/route.js.map +5 -0
- package/.next/server/app/api/files/route.js.nft.json +1 -0
- package/.next/server/app/api/files/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/messages/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/messages/route/build-manifest.json +11 -0
- package/.next/server/app/api/messages/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/messages/route.js +7 -0
- package/.next/server/app/api/messages/route.js.map +5 -0
- package/.next/server/app/api/messages/route.js.nft.json +1 -0
- package/.next/server/app/api/messages/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/session/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/session/route/build-manifest.json +11 -0
- package/.next/server/app/api/session/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/session/route.js +7 -0
- package/.next/server/app/api/session/route.js.map +5 -0
- package/.next/server/app/api/session/route.js.nft.json +1 -0
- package/.next/server/app/api/session/route_client-reference-manifest.js +2 -0
- package/.next/server/app/api/stream/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/stream/route/build-manifest.json +11 -0
- package/.next/server/app/api/stream/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/stream/route.js +6 -0
- package/.next/server/app/api/stream/route.js.map +5 -0
- package/.next/server/app/api/stream/route.js.nft.json +1 -0
- package/.next/server/app/api/stream/route_client-reference-manifest.js +2 -0
- package/.next/server/app/favicon.ico/route/app-paths-manifest.json +3 -0
- package/.next/server/app/favicon.ico/route/build-manifest.json +11 -0
- package/.next/server/app/favicon.ico/route.js +8 -0
- package/.next/server/app/favicon.ico/route.js.map +5 -0
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
- package/.next/server/app/favicon.ico.body +0 -0
- package/.next/server/app/favicon.ico.meta +1 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +14 -0
- package/.next/server/app/index.rsc +21 -0
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +9 -0
- package/.next/server/app/index.segments/_full.segment.rsc +21 -0
- package/.next/server/app/index.segments/_head.segment.rsc +6 -0
- package/.next/server/app/index.segments/_index.segment.rsc +6 -0
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -0
- package/.next/server/app/page/app-paths-manifest.json +3 -0
- package/.next/server/app/page/build-manifest.json +16 -0
- package/.next/server/app/page/next-font-manifest.json +11 -0
- package/.next/server/app/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/page/server-reference-manifest.json +4 -0
- package/.next/server/app/page.js +16 -0
- package/.next/server/app/page.js.map +5 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +2 -0
- package/.next/server/app-paths-manifest.json +13 -0
- package/.next/server/chunks/33f32_next_b78429d5._.js +17 -0
- package/.next/server/chunks/33f32_next_b78429d5._.js.map +1 -0
- package/.next/server/chunks/33f32_next_dist_esm_build_templates_app-route_5a539e27.js +3 -0
- package/.next/server/chunks/33f32_next_dist_esm_build_templates_app-route_5a539e27.js.map +1 -0
- package/.next/server/chunks/[externals]_next_dist_b89b5a39._.js +3 -0
- package/.next/server/chunks/[externals]_next_dist_b89b5a39._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__2554f0b0._.js +17 -0
- package/.next/server/chunks/[root-of-the-server]__2554f0b0._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__5e671cad._.js +7 -0
- package/.next/server/chunks/[root-of-the-server]__5e671cad._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__629f5815._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__629f5815._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__633f9ccd._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__633f9ccd._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__65cdeb73._.js +17 -0
- package/.next/server/chunks/[root-of-the-server]__65cdeb73._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__bc57ef5b._.js +21 -0
- package/.next/server/chunks/[root-of-the-server]__bc57ef5b._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__be62c218._.js +17 -0
- package/.next/server/chunks/[root-of-the-server]__be62c218._.js.map +1 -0
- package/.next/server/chunks/[root-of-the-server]__e87dbf93._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__e87dbf93._.js.map +1 -0
- package/.next/server/chunks/[turbopack]_runtime.js +795 -0
- package/.next/server/chunks/[turbopack]_runtime.js.map +10 -0
- package/.next/server/chunks/c45a0_nextpi__next-internal_server_app_api_files_[___path]_route_actions_16a66e62.js +3 -0
- package/.next/server/chunks/c45a0_nextpi__next-internal_server_app_api_files_[___path]_route_actions_16a66e62.js.map +1 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_chat_route_actions_e342cdbf.js +3 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_chat_route_actions_e342cdbf.js.map +1 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_config_route_actions_04d1272c.js +3 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_config_route_actions_04d1272c.js.map +1 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_files_route_actions_a8035013.js +3 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_files_route_actions_a8035013.js.map +1 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_messages_route_actions_4f52ac4b.js +3 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_messages_route_actions_4f52ac4b.js.map +1 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_session_route_actions_ff684c69.js +3 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_session_route_actions_ff684c69.js.map +1 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_stream_route_actions_7a0f6dba.js +3 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_api_stream_route_actions_7a0f6dba.js.map +1 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_favicon_ico_route_actions_2526216f.js +3 -0
- package/.next/server/chunks/picode_nextpi__next-internal_server_app_favicon_ico_route_actions_2526216f.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_580d3573._.js +6 -0
- package/.next/server/chunks/ssr/33f32_next_dist_580d3573._.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_85b0ccc0._.js +4 -0
- package/.next/server/chunks/ssr/33f32_next_dist_85b0ccc0._.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_a8ffe8d4._.js +3 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_a8ffe8d4._.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_builtin_forbidden_ad97660b.js +3 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_builtin_forbidden_ad97660b.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_builtin_global-error_ab28468b.js +3 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_builtin_global-error_ab28468b.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_builtin_unauthorized_edd1fe08.js +3 -0
- package/.next/server/chunks/ssr/33f32_next_dist_client_components_builtin_unauthorized_edd1fe08.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_esm_build_templates_app-page_5ef96b51.js +4 -0
- package/.next/server/chunks/ssr/33f32_next_dist_esm_build_templates_app-page_5ef96b51.js.map +1 -0
- package/.next/server/chunks/ssr/33f32_next_dist_server_route-modules_app-page_vendored_ssr_react-dom_33aeae20.js +3 -0
- package/.next/server/chunks/ssr/33f32_next_dist_server_route-modules_app-page_vendored_ssr_react-dom_33aeae20.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__028106ef._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__028106ef._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0dc9a9e1._.js +4 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0dc9a9e1._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__15f57d5d._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__15f57d5d._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__26f2451b._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__26f2451b._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__42ddc417._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__42ddc417._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__6823e2d4._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__6823e2d4._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__6bf5dd5d._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__6bf5dd5d._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__7b7d477c._.js +10 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__7b7d477c._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__85c46341._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__85c46341._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__99c61367._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__99c61367._.js.map +1 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__a0bdeac8._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__a0bdeac8._.js.map +1 -0
- package/.next/server/chunks/ssr/[turbopack]_runtime.js +795 -0
- package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +10 -0
- package/.next/server/chunks/ssr/_091ac666._.js +3 -0
- package/.next/server/chunks/ssr/_091ac666._.js.map +1 -0
- package/.next/server/chunks/ssr/picode_nextpi_1e69e558._.js +4 -0
- package/.next/server/chunks/ssr/picode_nextpi_1e69e558._.js.map +1 -0
- package/.next/server/chunks/ssr/picode_nextpi_4fadcd01._.js +3 -0
- package/.next/server/chunks/ssr/picode_nextpi_4fadcd01._.js.map +1 -0
- package/.next/server/chunks/ssr/picode_nextpi__next-internal_server_app__global-error_page_actions_91eb1cf1.js +3 -0
- package/.next/server/chunks/ssr/picode_nextpi__next-internal_server_app__global-error_page_actions_91eb1cf1.js.map +1 -0
- package/.next/server/chunks/ssr/picode_nextpi__next-internal_server_app__not-found_page_actions_0a31df41.js +3 -0
- package/.next/server/chunks/ssr/picode_nextpi__next-internal_server_app__not-found_page_actions_0a31df41.js.map +1 -0
- package/.next/server/chunks/ssr/picode_nextpi__next-internal_server_app_page_actions_b14d985f.js +3 -0
- package/.next/server/chunks/ssr/picode_nextpi__next-internal_server_app_page_actions_b14d985f.js.map +1 -0
- package/.next/server/chunks/ssr/picode_nextpi_app_77d1bd95._.js +3 -0
- package/.next/server/chunks/ssr/picode_nextpi_app_77d1bd95._.js.map +1 -0
- package/.next/server/chunks/ssr/picode_nextpi_app_page_tsx_cebd7814._.js +3 -0
- package/.next/server/chunks/ssr/picode_nextpi_app_page_tsx_cebd7814._.js.map +1 -0
- package/.next/server/functions-config-manifest.json +4 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +20 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +15 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +2 -0
- package/.next/server/pages-manifest.json +4 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +5 -0
- package/.next/static/PdRtiPZ_ExBLCzmKGXOBT/_buildManifest.js +11 -0
- package/.next/static/PdRtiPZ_ExBLCzmKGXOBT/_clientMiddlewareManifest.json +1 -0
- package/.next/static/PdRtiPZ_ExBLCzmKGXOBT/_ssgManifest.js +1 -0
- package/.next/static/chunks/0ab43a45e07af0f9.js +1 -0
- package/.next/static/chunks/265e06106152dcbb.js +1 -0
- package/.next/static/chunks/65d5124f3edd1b84.js +1 -0
- package/.next/static/chunks/76111d9b2044b643.js +1 -0
- package/.next/static/chunks/81dfdd74986c8afe.css +3 -0
- package/.next/static/chunks/93b85e5de0842835.js +5 -0
- package/.next/static/chunks/a6dad97d9634a72d.js +1 -0
- package/.next/static/chunks/a6dad97d9634a72d.js.map +1 -0
- package/.next/static/chunks/cace1b477872431f.js +1 -0
- package/.next/static/chunks/turbopack-775e95d747b6e667.js +4 -0
- package/.next/static/media/4fa387ec64143e14-s.c1fdd6c2.woff2 +0 -0
- package/.next/static/media/7178b3e590c64307-s.b97b3418.woff2 +0 -0
- package/.next/static/media/797e433ab948586e-s.p.dbea232f.woff2 +0 -0
- package/.next/static/media/8a480f0b521d4e75-s.8e0177b5.woff2 +0 -0
- package/.next/static/media/bbc41e54d2fcbd21-s.799d8ef8.woff2 +0 -0
- package/.next/static/media/caa3a2e1cccd8315-s.p.853070df.woff2 +0 -0
- package/.next/static/media/favicon.0b3bf435.ico +0 -0
- package/.next/trace +1 -0
- package/.next/trace-build +1 -0
- package/.next/turbopack +0 -0
- package/.next/types/routes.d.ts +79 -0
- package/.next/types/validator.ts +133 -0
- package/README.md +50 -0
- package/app/api/chat/route.ts +28 -0
- package/app/api/config/route.ts +25 -0
- package/app/api/files/[...path]/route.ts +55 -0
- package/app/api/files/route.ts +62 -0
- package/app/api/messages/route.ts +26 -0
- package/app/api/session/route.ts +55 -0
- package/app/api/stream/route.ts +76 -0
- package/app/favicon.ico +0 -0
- package/app/globals.css +1143 -0
- package/app/layout.tsx +46 -0
- package/app/page.tsx +1643 -0
- package/bin/cli.js +85 -0
- package/components/.gitkeep +0 -0
- package/components/theme-provider.tsx +71 -0
- package/components/ui/button.tsx +67 -0
- package/components/ui/file-tree.tsx +560 -0
- package/lib/.gitkeep +0 -0
- package/lib/agent.ts +105 -0
- package/lib/config.ts +50 -0
- package/lib/root-path.ts +15 -0
- package/lib/session-singleton.ts +48 -0
- package/lib/utils.ts +6 -0
- package/package.json +72 -0
- package/public/.gitkeep +0 -0
- package/src/agent.ts +82 -0
- package/src/cli.ts +107 -0
- package/src/tools.ts +71 -0
- package/src/tui.ts +238 -0
- package/src/web-server.ts +280 -0
- package/tsconfig.json +34 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},8475,e=>{"use strict";var t=e.i(29662),r=e.i(58683),n=e.i(28986),a=e.i(97570),s=e.i(179),o=e.i(11773),i=e.i(4889),l=e.i(84191),u=e.i(23718),d=e.i(35879),p=e.i(80305),c=e.i(16854),x=e.i(75719),h=e.i(14940),f=e.i(8112),R=e.i(93695);e.i(70635);var v=e.i(20150),g=e.i(69218),y=e.i(22734),E=e.i(14747),w=e.i(46786);let m=E.default.join(w.default.homedir(),".nextpi"),A=E.default.join(m,"config.json");function C(){try{if(!y.default.existsSync(A))return{};let e=y.default.readFileSync(A,"utf-8");return JSON.parse(e)}catch(e){return console.error("Error reading config:",e),{}}}async function N(){let e=process.env.OPENROUTER_API_KEY||C().openRouterApiKey;return g.NextResponse.json({hasKey:!!e,maskedKey:e?`${e.slice(0,4)}...${e.slice(-4)}`:null})}async function P(e){try{let{apiKey:t}=await e.json();if(!t)return g.NextResponse.json({error:"API Key is required"},{status:400});return!function(e){try{y.default.existsSync(m)||y.default.mkdirSync(m,{recursive:!0});let t={...C(),...e};y.default.writeFileSync(A,JSON.stringify(t,null,2)),t.openRouterApiKey&&(process.env.OPENROUTER_API_KEY=t.openRouterApiKey)}catch(e){throw console.error("Error saving config:",e),e}}({openRouterApiKey:t}),g.NextResponse.json({success:!0})}catch(e){return g.NextResponse.json({error:"Failed to save config"},{status:500})}}e.s(["GET",()=>N,"POST",()=>P],22602);var O=e.i(22602);let T=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/config/route",pathname:"/api/config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/picode/nextpi/app/api/config/route.ts",nextConfigOutput:"",userland:O}),{workAsyncStorage:b,workUnitAsyncStorage:S,serverHooks:j}=T;function _(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:S})}async function k(e,t,n){T.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/config/route";g=g.replace(/\/index$/,"")||"/";let y=await T.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:E,params:w,nextConfig:m,parsedUrl:A,isDraftMode:C,prerenderManifest:N,routerServerContext:P,isOnDemandRevalidate:O,revalidateOnlyGenerated:b,resolvedPathname:S,clientReferenceManifest:j,serverActionsManifest:_}=y,k=(0,i.normalizeAppPath)(g),q=!!(N.dynamicRoutes[k]||N.routes[S]),I=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,A,!1):t.end("This page could not be found"),null);if(q&&!C){let e=!!N.routes[S],t=N.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(m.experimental.adapterPath)return await I();throw new R.NoFallbackError}}let U=null;!q||T.isDev||C||(U="/index"===(U=S)?"/":U);let H=!0===T.isDev||!q,K=q&&!H;_&&j&&(0,o.setManifestsSingleton)({page:g,clientReferenceManifest:j,serverActionsManifest:_});let D=e.method||"GET",M=(0,s.getTracer)(),F=M.getActiveScopeSpan(),$={params:w,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!m.experimental.authInterrupts},cacheComponents:!!m.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:m.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>T.onRequestError(e,t,n,a,P)},sharedContext:{buildId:E}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),G=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let o=async e=>T.handle(G,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let 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} ${g}`)}),i=!!(0,a.getRequestMeta)(e,"minimalMode"),l=async a=>{var s,l;let u=async({previousCacheEntry:r})=>{try{if(!i&&O&&b&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(a);e.fetchMetrics=$.renderOpts.fetchMetrics;let l=$.renderOpts.pendingWaitUntil;l&&n.waitUntil&&(n.waitUntil(l),l=void 0);let u=$.renderOpts.collectedTags;if(!q)return await (0,c.sendResponse)(B,L,s,$.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(s.headers);u&&(t[f.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,n=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=f.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await T.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:O})},!1,P),t}},d=await T.handleResponse({req:e,nextConfig:m,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:b,responseGenerator:u,waitUntil:n.waitUntil,isMinimalMode:i});if(!q)return null;if((null==d||null==(s=d.value)?void 0:s.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(l=d.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});i||t.setHeader("x-nextjs-cache",O?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let R=(0,x.fromNodeOutgoingHttpHeaders)(d.value.headers);return i&&q||R.delete(f.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||R.get("Cache-Control")||R.set("Cache-Control",(0,h.getCacheControlHeader)(d.cacheControl)),await (0,c.sendResponse)(B,L,new Response(d.value.body,{headers:R,status:d.value.status||200})),null};F?await l(F):await M.withPropagatedContext(e.headers,()=>M.trace(d.BaseServerSpan.handleRequest,{spanName:`${D} ${g}`,kind:s.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},l))}catch(t){if(t instanceof R.NoFallbackError||await T.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:O})},!1,P),q)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>k,"patchFetch",()=>_,"routeModule",()=>T,"serverHooks",()=>j,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>S],8475)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__629f5815._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../picode/nextpi/app/api/config/route.ts","../../../../../picode/nextpi/lib/config.ts","../../../../../picode/nextpi/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextRequest, NextResponse } from 'next/server';\nimport { getConfig, saveConfig, getEffectiveApiKey } from '@/lib/config';\n\nexport async function GET() {\n const apiKey = getEffectiveApiKey();\n return NextResponse.json({ \n hasKey: !!apiKey,\n // We don't return the full key for safety, just first 4 and last 4\n maskedKey: apiKey ? `${apiKey.slice(0, 4)}...${apiKey.slice(-4)}` : null\n });\n}\n\nexport async function POST(request: NextRequest) {\n try {\n const { apiKey } = await request.json();\n if (!apiKey) {\n return NextResponse.json({ error: 'API Key is required' }, { status: 400 });\n }\n \n saveConfig({ openRouterApiKey: apiKey });\n return NextResponse.json({ success: true });\n } catch (error) {\n return NextResponse.json({ error: 'Failed to save config' }, { status: 500 });\n }\n}\n","import fs from 'fs';\nimport path from 'path';\nimport os from 'os';\n\nconst CONFIG_DIR = path.join(os.homedir(), '.nextpi');\nconst CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');\n\nexport interface NextPiConfig {\n openRouterApiKey?: string;\n defaultModel?: string;\n}\n\nexport function getConfig(): NextPiConfig {\n try {\n if (!fs.existsSync(CONFIG_FILE)) {\n return {};\n }\n const data = fs.readFileSync(CONFIG_FILE, 'utf-8');\n return JSON.parse(data);\n } catch (err) {\n console.error('Error reading config:', err);\n return {};\n }\n}\n\nexport function saveConfig(newConfig: Partial<NextPiConfig>) {\n try {\n if (!fs.existsSync(CONFIG_DIR)) {\n fs.mkdirSync(CONFIG_DIR, { recursive: true });\n }\n const current = getConfig();\n const updated = { ...current, ...newConfig };\n fs.writeFileSync(CONFIG_FILE, JSON.stringify(updated, null, 2));\n \n // Also update current process env for immediate use\n if (updated.openRouterApiKey) {\n process.env.OPENROUTER_API_KEY = updated.openRouterApiKey;\n }\n \n return updated;\n } catch (err) {\n console.error('Error saving config:', err);\n throw err;\n }\n}\n\nexport function getEffectiveApiKey(): string | undefined {\n // Priority: 1. Environment Variable, 2. Config File\n return process.env.OPENROUTER_API_KEY || getConfig().openRouterApiKey;\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/config/route\",\n pathname: \"/api/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]/picode/nextpi/app/api/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/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(nodeNext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IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[2]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[45678,e=>{"use strict";var t=e.i(14747);function r(){let e=process.env.PI_ROOT;return e?t.default.resolve(e):process.cwd()}e.s(["getProjectRoot",()=>r])},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},9732,e=>{"use strict";var t=e.i(29662),r=e.i(58683),a=e.i(28986),n=e.i(97570),s=e.i(179),i=e.i(11773),o=e.i(4889),l=e.i(84191),d=e.i(23718),u=e.i(35879),p=e.i(80305),c=e.i(16854),h=e.i(75719),x=e.i(14940),f=e.i(8112),R=e.i(93695);e.i(70635);var v=e.i(20150),m=e.i(69218),g=e.i(22734),w=e.i(14747),y=e.i(45678);async function E(e,t){let r=await g.promises.readdir(e,{withFileTypes:!0}),a=[];for(let n of r){let r=w.default.join(e,n.name),s=w.default.relative(t,r);if(n.isDirectory()){if("node_modules"===n.name||".next"===n.name||".git"===n.name)continue;let e=await E(r,t);a.push({id:s,name:n.name,type:"folder",isSelectable:!0,children:e})}else a.push({id:s,name:n.name,type:"file",isSelectable:!0})}return a.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):"folder"===e.type?-1:1)}async function C(){try{let e=(0,y.getProjectRoot)(),t=await E(e,e);return m.NextResponse.json({elements:t})}catch(e){return m.NextResponse.json({error:e.message},{status:500})}}e.s(["GET",()=>C],9772);var b=e.i(9772);let A=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/files/route",pathname:"/api/files",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/picode/nextpi/app/api/files/route.ts",nextConfigOutput:"",userland:b}),{workAsyncStorage:T,workUnitAsyncStorage:P,serverHooks:N}=A;function O(){return(0,a.patchFetch)({workAsyncStorage:T,workUnitAsyncStorage:P})}async function j(e,t,a){A.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/files/route";m=m.replace(/\/index$/,"")||"/";let g=await A.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,params:y,nextConfig:E,parsedUrl:C,isDraftMode:b,prerenderManifest:T,routerServerContext:P,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,resolvedPathname:j,clientReferenceManifest:_,serverActionsManifest:k}=g,q=(0,o.normalizeAppPath)(m),S=!!(T.dynamicRoutes[q]||T.routes[j]),H=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,C,!1):t.end("This page could not be found"),null);if(S&&!b){let e=!!T.routes[j],t=T.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await H();throw new R.NoFallbackError}}let I=null;!S||A.isDev||b||(I="/index"===(I=j)?"/":I);let U=!0===A.isDev||!S,D=S&&!U;k&&_&&(0,i.setManifestsSingleton)({page:m,clientReferenceManifest:_,serverActionsManifest:k});let M=e.method||"GET",F=(0,s.getTracer)(),$=F.getActiveScopeSpan(),K={params:y,prerenderManifest:T,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>A.onRequestError(e,t,a,n,P)},sharedContext:{buildId:w}},B=new l.NodeNextRequest(e),L=new l.NodeNextResponse(t),G=d.NextRequestAdapter.fromNodeNextRequest(B,(0,d.signalFromNodeResponse)(t));try{let i=async e=>A.handle(G,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${m}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&N&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=K.renderOpts.fetchMetrics;let l=K.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=K.renderOpts.collectedTags;if(!S)return await (0,c.sendResponse)(B,L,s,K.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[f.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,a=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=f.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await A.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:N})},!1,P),t}},u=await A.handleResponse({req:e,nextConfig:E,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!S)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==v.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",N?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),b&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let R=(0,h.fromNodeOutgoingHttpHeaders)(u.value.headers);return o&&S||R.delete(f.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||R.get("Cache-Control")||R.set("Cache-Control",(0,x.getCacheControlHeader)(u.cacheControl)),await (0,c.sendResponse)(B,L,new Response(u.value.body,{headers:R,status:u.value.status||200})),null};$?await l($):await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${M} ${m}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof R.NoFallbackError||await A.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:N})},!1,P),S)throw t;return await (0,c.sendResponse)(B,L,new Response(null,{status:500})),null}}e.s(["handler",()=>j,"patchFetch",()=>O,"routeModule",()=>A,"serverHooks",()=>N,"workAsyncStorage",()=>T,"workUnitAsyncStorage",()=>P],9732)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__633f9ccd._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../picode/nextpi/lib/root-path.ts","../../../../../picode/nextpi/app/api/files/route.ts","../../../../../picode/nextpi/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import path from 'path';\n\nexport function getProjectRoot() {\n // PI_ROOT can be set via environment variable to override the root directory\n const envRoot = process.env.PI_ROOT;\n \n if (envRoot) {\n // Resolve the path to handle relative paths from where the process was started\n return path.resolve(envRoot);\n }\n\n // If no PI_ROOT is set, fallback to process.cwd()\n // Note: in a Next.js environment during dev/build, process.cwd() is the project root.\n return process.cwd();\n}\n","import { NextResponse } from 'next/server';\nimport { promises as fs } from 'fs';\nimport path from 'path';\nimport { getProjectRoot } from '@/lib/root-path';\n\ninterface TreeViewElement {\n id: string;\n name: string;\n type: 'file' | 'folder';\n isSelectable?: boolean;\n children?: TreeViewElement[];\n}\n\nasync function scanDirectory(dirPath: string, basePath: string): Promise<TreeViewElement[]> {\n const entries = await fs.readdir(dirPath, { withFileTypes: true });\n const elements: TreeViewElement[] = [];\n\n for (const entry of entries) {\n const fullPath = path.join(dirPath, entry.name);\n const relativePath = path.relative(basePath, fullPath);\n const id = relativePath;\n\n if (entry.isDirectory()) {\n if (entry.name === 'node_modules' || entry.name === '.next' || entry.name === '.git') {\n continue;\n }\n const children = await scanDirectory(fullPath, basePath);\n elements.push({\n id,\n name: entry.name,\n type: 'folder',\n isSelectable: true,\n children,\n });\n } else {\n elements.push({\n id,\n name: entry.name,\n type: 'file',\n isSelectable: true,\n });\n }\n }\n\n return elements.sort((a, b) => {\n if (a.type === b.type) {\n return a.name.localeCompare(b.name);\n }\n return a.type === 'folder' ? -1 : 1;\n });\n}\n\nexport async function GET() {\n try {\n const projectRoot = getProjectRoot();\n const elements = await scanDirectory(projectRoot, projectRoot);\n\n return NextResponse.json({ elements });\n } catch (error: any) {\n return NextResponse.json({ error: error.message }, { status: 500 });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/files/route\",\n pathname: \"/api/files\",\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]/picode/nextpi/app/api/files/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/files/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":"uCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEO,SAAS,IAEd,IAAM,EAAU,QAAQ,GAAG,CAAC,OAAO,QAEnC,AAAI,EAEK,EAAA,KAFI,EAEA,CAAC,OAAO,CAAC,GAKf,QAAQ,GAAG,EACpB,u/BEdA,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,KACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,MACA,EAAA,EAAA,CAAA,CAAA,OAC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_ROOT;return e?t.default.resolve(e):process.cwd()}e.s(["getProjectRoot",()=>r])},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},59291,e=>e.a(async(t,r)=>{try{let t=await e.y("@mariozechner/pi-coding-agent-fd851c154169d599");e.n(t),r()}catch(e){r(e)}},!0),18242,e=>e.a(async(t,r)=>{try{let t=await e.y("@mariozechner/pi-ai-48e4ee29412715d1");e.n(t),r()}catch(e){r(e)}},!0),3202,e=>e.a(async(t,r)=>{try{var a=e.i(59291),n=e.i(18242),s=e.i(14747),i=e.i(22734),o=e.i(45678),l=t([a,n]);[a,n]=l.then?(await l)():l;let c=[{name:"web_search",description:"Search the web for information using Exa AI",parameters:{type:"object",properties:{query:{type:"string",description:"Search query"},numResults:{type:"number",description:"Number of results (default: 5)"}},required:["query"]}},{name:"web_fetch",description:"Fetch content from a specific URL",parameters:{type:"object",properties:{url:{type:"string",description:"URL to fetch"}},required:["url"]}}];async function d(e={}){let{sessionDir:t=s.join((0,o.getProjectRoot)(),".sessions"),sessionFile:r=s.join(t,"research-agent.jsonl"),modelId:l="openrouter/free",thinkingLevel:p="low"}=e;i.mkdirSync(t,{recursive:!0});let h=(0,n.getModel)("openrouter",l),{session:g}=await (0,a.createAgentSession)({model:h,thinkingLevel:p,systemPrompt:u,sessionManager:a.SessionManager.open(r),customTools:c});return g.agent.streamFn,g.agent.streamFn=(e,t,r)=>(0,n.streamSimple)(e,t,{...r,headers:{...r?.headers,"X-Title":"NextPi Agent","HTTP-Referer":"https://github.com/drewsepsi/nextpi"}}),g}let u=`You are NextPi, an expert research and coding assistant. You have access to the web and the local file system.
|
|
2
|
+
|
|
3
|
+
### GUIDELINES
|
|
4
|
+
- ALWAYS start by explaining your plan to the user in the main message or thinking block.
|
|
5
|
+
- BEFORE calling any tool that modifies the file system (write_file, edit_file, etc.), you MUST describe the specific changes you are about to make and why.
|
|
6
|
+
- If you are editing a file, summarize the intended changes first.
|
|
7
|
+
- If you are researching, explain what you hope to find.
|
|
8
|
+
|
|
9
|
+
### CAPABILITIES
|
|
10
|
+
1. **Web Search**: Search for docs, errors, news, etc.
|
|
11
|
+
2. **Web Fetch**: Read specific URLs.
|
|
12
|
+
3. **File Operations**: Read, write, list (ls), and edit files.
|
|
13
|
+
4. **Shell**: Execute bash commands for testing or exploration.
|
|
14
|
+
|
|
15
|
+
Always be surgical with edits and transparent with your process.`;e.s(["createResearchAgent",()=>d]),r()}catch(e){r(e)}},!1),23202,e=>e.a(async(t,r)=>{try{let o;var a=e.i(3202),n=t([a]);[a]=n.then?(await n)():n;let l=globalThis;async function s(){return l._sharedSession?l._sharedSession:(l._sharedSessionPromise||(console.log(`[Agent] Initializing new shared session singleton (Model: ${o||"default"})...`),l._sharedSessionPromise=(0,a.createResearchAgent)({modelId:o}).then(e=>(l._sharedSession=e,console.log("[Agent] Shared session initialized"),e))),l._sharedSessionPromise)}function i(e){console.log(`[Agent] Resetting shared session${e?` to model ${e}`:""}...`),e&&(o=e),l._sharedSession=void 0,l._sharedSessionPromise=void 0}e.s(["getSharedSession",()=>s,"resetSharedSession",()=>i]),r()}catch(e){r(e)}},!1),12924,e=>e.a(async(t,r)=>{try{var a=e.i(69218),n=e.i(23202),s=t([n]);async function i(){try{let e=(await (0,n.getSharedSession)()).messages.map(e=>({id:e.id||`msg-${Math.random().toString(36).slice(2,9)}`,content:Array.isArray(e.content)?e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n"):e.content,thinking:e.thinking,isUser:"user"===e.role,timestamp:e.timestamp}));return a.NextResponse.json({messages:e})}catch(e){return console.error("[Messages] Error fetching history:",e),a.NextResponse.json({error:e.message},{status:500})}}[n]=s.then?(await s)():s,e.s(["GET",()=>i]),r()}catch(e){r(e)}},!1),21882,e=>e.a(async(t,r)=>{try{var a=e.i(29662),n=e.i(58683),s=e.i(28986),i=e.i(97570),o=e.i(179),l=e.i(11773),d=e.i(4889),c=e.i(84191),u=e.i(23718),p=e.i(35879),h=e.i(80305),g=e.i(16854),m=e.i(75719),f=e.i(14940),x=e.i(8112),y=e.i(93695);e.i(70635);var R=e.i(20150),w=e.i(12924),v=t([w]);[w]=v.then?(await v)():v;let b=new a.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/messages/route",pathname:"/api/messages",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/picode/nextpi/app/api/messages/route.ts",nextConfigOutput:"",userland:w}),{workAsyncStorage:A,workUnitAsyncStorage:C,serverHooks:P}=b;function E(){return(0,s.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:C})}async function S(e,t,r){b.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let a="/api/messages/route";a=a.replace(/\/index$/,"")||"/";let s=await b.prepare(e,t,{srcPage:a,multiZoneDraftMode:!1});if(!s)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:w,params:v,nextConfig:E,parsedUrl:S,isDraftMode:A,prerenderManifest:C,routerServerContext:P,isOnDemandRevalidate:T,revalidateOnlyGenerated:_,resolvedPathname:N,clientReferenceManifest:j,serverActionsManifest:k}=s,q=(0,d.normalizeAppPath)(a),I=!!(C.dynamicRoutes[q]||C.routes[N]),O=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,S,!1):t.end("This page could not be found"),null);if(I&&!A){let e=!!C.routes[N],t=C.dynamicRoutes[q];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await O();throw new y.NoFallbackError}}let U=null;!I||b.isDev||A||(U=N,U="/index"===U?"/":U);let M=!0===b.isDev||!I,H=I&&!M;k&&j&&(0,l.setManifestsSingleton)({page:a,clientReferenceManifest:j,serverActionsManifest:k});let D=e.method||"GET",F=(0,o.getTracer)(),$=F.getActiveScopeSpan(),L={params:v,prerenderManifest:C,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:(0,i.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,P)},sharedContext:{buildId:w}},K=new c.NodeNextRequest(e),B=new c.NodeNextResponse(t),z=u.NextRequestAdapter.fromNodeNextRequest(K,(0,u.signalFromNodeResponse)(t));try{let s=async e=>b.handle(z,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==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=`${D} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t)}else e.updateName(`${D} ${a}`)}),l=!!(0,i.getRequestMeta)(e,"minimalMode"),d=async i=>{var o,d;let c=async({previousCacheEntry:n})=>{try{if(!l&&T&&_&&!n)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await s(i);e.fetchMetrics=L.renderOpts.fetchMetrics;let o=L.renderOpts.pendingWaitUntil;o&&r.waitUntil&&(r.waitUntil(o),o=void 0);let d=L.renderOpts.collectedTags;if(!I)return await (0,g.sendResponse)(K,B,a,L.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(a.headers);d&&(t[x.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,n=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==n?void 0:n.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:a,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,P),t}},u=await b.handleResponse({req:e,nextConfig:E,cacheKey:U,routeKind:n.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:_,responseGenerator:c,waitUntil:r.waitUntil,isMinimalMode:l});if(!I)return null;if((null==u||null==(o=u.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(d=u.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});l||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return l&&I||p.delete(x.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,f.getCacheControlHeader)(u.cacheControl)),await (0,g.sendResponse)(K,B,new Response(u.value.body,{headers:p,status:u.value.status||200})),null};$?await d($):await F.withPropagatedContext(e.headers,()=>F.trace(p.BaseServerSpan.handleRequest,{spanName:`${D} ${a}`,kind:o.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},d))}catch(t){if(t instanceof y.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:q,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:T})},!1,P),I)throw t;return await (0,g.sendResponse)(K,B,new Response(null,{status:500})),null}}e.s(["handler",()=>S,"patchFetch",()=>E,"routeModule",()=>b,"serverHooks",()=>P,"workAsyncStorage",()=>A,"workUnitAsyncStorage",()=>C]),r()}catch(e){r(e)}},!1)];
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__65cdeb73._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../picode/nextpi/lib/root-path.ts","../../../../../picode/nextpi/lib/agent.ts","../../../../../picode/nextpi/lib/session-singleton.ts","../../../../../picode/nextpi/app/api/messages/route.ts","../../../../../picode/nextpi/node_modules/next/src/build/templates/app-route.ts"],"sourcesContent":["import path from 'path';\n\nexport function getProjectRoot() {\n // PI_ROOT can be set via environment variable to override the root directory\n const envRoot = process.env.PI_ROOT;\n \n if (envRoot) {\n // Resolve the path to handle relative paths from where the process was started\n return path.resolve(envRoot);\n }\n\n // If no PI_ROOT is set, fallback to process.cwd()\n // Note: in a Next.js environment during dev/build, process.cwd() is the project root.\n return process.cwd();\n}\n","import { \n createAgentSession, \n SessionManager, \n type AgentSession \n} from \"@mariozechner/pi-coding-agent\";\nimport { getModel, streamSimple } from \"@mariozechner/pi-ai\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\nimport { getProjectRoot } from \"./root-path\";\nimport { getEffectiveApiKey } from \"./config\";\n\nexport interface ResearchAgentConfig {\n sessionDir?: string;\n sessionFile?: string;\n modelId?: string;\n thinkingLevel?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n}\n\n// Default OpenRouter model\nconst DEFAULT_MODEL = \"openrouter/free\";\n\n// Research tools (web search, web fetch)\nconst researchTools = [\n {\n name: \"web_search\",\n description: \"Search the web for information using Exa AI\",\n parameters: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n numResults: { type: \"number\", description: \"Number of results (default: 5)\" }\n },\n required: [\"query\"]\n }\n },\n {\n name: \"web_fetch\",\n description: \"Fetch content from a specific URL\",\n parameters: {\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" }\n },\n required: [\"url\"]\n }\n }\n];\n\nexport async function createResearchAgent(\n config: ResearchAgentConfig = {}\n): Promise<AgentSession> {\n const {\n sessionDir = path.join(getProjectRoot(), \".sessions\"),\n sessionFile = path.join(sessionDir, \"research-agent.jsonl\"),\n modelId = DEFAULT_MODEL,\n thinkingLevel = \"low\",\n } = config;\n\n // Ensure session directory exists\n fs.mkdirSync(sessionDir, { recursive: true });\n\n // Use OpenRouter model\n const model = getModel(\"openrouter\", modelId as \"openrouter/free\");\n\n // Create session with research tools and system prompt\n const { session } = await createAgentSession({\n model,\n thinkingLevel,\n systemPrompt: RESEARCH_SYSTEM_PROMPT,\n sessionManager: SessionManager.open(sessionFile),\n customTools: researchTools as any,\n } as any);\n\n // Wrap stream function with OpenRouter headers\n const originalStreamFn = session.agent.streamFn;\n session.agent.streamFn = (model, context, options) => {\n return streamSimple(model, context, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-Title\": \"NextPi Agent\",\n \"HTTP-Referer\": \"https://github.com/drewsepsi/nextpi\",\n },\n });\n };\n\n return session;\n}\n\n// System prompt for research and coding\nexport const RESEARCH_SYSTEM_PROMPT = `You are NextPi, an expert research and coding assistant. You have access to the web and the local file system.\n\n### GUIDELINES\n- ALWAYS start by explaining your plan to the user in the main message or thinking block.\n- BEFORE calling any tool that modifies the file system (write_file, edit_file, etc.), you MUST describe the specific changes you are about to make and why.\n- If you are editing a file, summarize the intended changes first.\n- If you are researching, explain what you hope to find.\n\n### CAPABILITIES\n1. **Web Search**: Search for docs, errors, news, etc.\n2. **Web Fetch**: Read specific URLs.\n3. **File Operations**: Read, write, list (ls), and edit files.\n4. **Shell**: Execute bash commands for testing or exploration.\n\nAlways be surgical with edits and transparent with your process.`;\n","import { createResearchAgent } from '@/lib/agent';\n\ntype AgentSession = Awaited<ReturnType<typeof createResearchAgent>>;\n\n/**\n * In Next.js development mode, modules are frequently re-evaluated due to HMR.\n * Attaching the session to `globalThis` ensures that all API routes (which may\n * be running in different contexts or re-evaluated modules) share exactly\n * the same AgentSession instance.\n */\nconst globalForAgent = globalThis as unknown as {\n _sharedSession?: AgentSession;\n _sharedSessionPromise?: Promise<AgentSession>;\n};\n\nlet currentModelId: string | undefined = undefined;\n\nexport async function getSharedSession(): Promise<AgentSession> {\n // Return the existing session if already initialized\n if (globalForAgent._sharedSession) {\n return globalForAgent._sharedSession;\n }\n\n // If a session is being created, wait for it\n if (globalForAgent._sharedSessionPromise) {\n return globalForAgent._sharedSessionPromise;\n }\n\n // Otherwise, create a new session and store the promise globally\n console.log(`[Agent] Initializing new shared session singleton (Model: ${currentModelId || 'default'})...`);\n globalForAgent._sharedSessionPromise = createResearchAgent({ modelId: currentModelId }).then((session) => {\n globalForAgent._sharedSession = session;\n console.log('[Agent] Shared session initialized');\n return session;\n });\n\n return globalForAgent._sharedSessionPromise;\n}\n\nexport function resetSharedSession(modelId?: string): void {\n console.log(`[Agent] Resetting shared session${modelId ? ` to model ${modelId}` : ''}...`);\n if (modelId) {\n currentModelId = modelId;\n }\n globalForAgent._sharedSession = undefined;\n globalForAgent._sharedSessionPromise = undefined;\n}\n\n","import { NextResponse } from 'next/server';\nimport { getSharedSession } from '@/lib/session-singleton';\n\nexport async function GET() {\n try {\n const agentSession = await getSharedSession();\n \n // Get messages from the session\n // AgentSession usually has a getHistory() or messages property\n // Looking at the library types, we can use session.messages\n const messages = agentSession.messages.map((msg: any) => ({\n id: msg.id || `msg-${Math.random().toString(36).slice(2, 9)}`,\n content: Array.isArray(msg.content) \n ? msg.content.filter((c: any) => c.type === 'text').map((c: any) => c.text).join('\\n')\n : msg.content,\n thinking: msg.thinking, // Store thinking if available\n isUser: msg.role === 'user',\n timestamp: msg.timestamp\n }));\n\n return NextResponse.json({ messages });\n } catch (error: any) {\n console.error('[Messages] Error fetching history:', error);\n return NextResponse.json({ error: error.message }, { status: 500 });\n }\n}\n","import {\n AppRouteRouteModule,\n type AppRouteRouteHandlerContext,\n type AppRouteRouteModuleOptions,\n} from '../../server/route-modules/app-route/module.compiled'\nimport { RouteKind } from '../../server/route-kind'\nimport { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { addRequestMeta, getRequestMeta } from '../../server/request-meta'\nimport { getTracer, type Span, SpanKind } from '../../server/lib/trace/tracer'\nimport { setManifestsSingleton } from '../../server/app-render/manifests-singleton'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { sendResponse } from '../../server/send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n toNodeOutgoingHttpHeaders,\n} from '../../server/web/utils'\nimport { getCacheControlHeader } from '../../server/lib/cache-control'\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\nimport {\n CachedRouteKind,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\n\nimport * as userland from 'VAR_USERLAND'\n\n// These are injected by the loader afterwards. This is injected as a variable\n// instead of a replacement because this could also be `undefined` instead of\n// an empty string.\ndeclare const nextConfigOutput: AppRouteRouteModuleOptions['nextConfigOutput']\n\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\n// INJECT:nextConfigOutput\n\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n filename: 'VAR_DEFINITION_FILENAME',\n bundlePath: 'VAR_DEFINITION_BUNDLE_PATH',\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',\n nextConfigOutput,\n userland,\n})\n\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule\n\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage,\n })\n}\n\nexport {\n routeModule,\n workAsyncStorage,\n workUnitAsyncStorage,\n serverHooks,\n patchFetch,\n}\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint())\n }\n let srcPage = 'VAR_DEFINITION_PAGE'\n\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\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n params,\n nextConfig,\n parsedUrl,\n isDraftMode,\n prerenderManifest,\n routerServerContext,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n resolvedPathname,\n clientReferenceManifest,\n serverActionsManifest,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let isIsr = Boolean(\n prerenderManifest.dynamicRoutes[normalizedSrcPage] ||\n prerenderManifest.routes[resolvedPathname]\n )\n\n const render404 = async () => {\n // TODO: should route-module itself handle rendering the 404\n if (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\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname])\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n\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\n let cacheKey: string | null = null\n\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\n const supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr\n\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\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\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n const context: AppRouteRouteHandlerContext = {\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: (\n error,\n _request,\n errorContext,\n silenceLog\n ) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n silenceLog,\n routerServerContext\n ),\n },\n sharedContext: {\n buildId,\n },\n }\n const nodeNextReq = new NodeNextRequest(req)\n const nodeNextRes = new NodeNextResponse(res)\n\n const nextReq = NextRequestAdapter.fromNodeNextRequest(\n nodeNextReq,\n signalFromNodeResponse(res)\n )\n\n try {\n const invokeRouteModule = async (span?: Span) => {\n return routeModule.handle(nextReq, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\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\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\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(\n process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode')\n )\n\n const handleResponse = async (currentSpan?: Span) => {\n const responseGenerator: ResponseGenerator = async ({\n previousCacheEntry,\n }) => {\n try {\n if (\n !isMinimalMode &&\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry\n ) {\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\n const response = await invokeRouteModule(currentSpan)\n\n ;(req as any).fetchMetrics = (context.renderOpts as any).fetchMetrics\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\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\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\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n }\n\n return cacheEntry\n } else {\n // send response without caching if not ISR\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n response,\n context.renderOpts.pendingWaitUntil\n )\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?.isStale) {\n const silenceLog = false\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate,\n }),\n },\n silenceLog,\n routerServerContext\n )\n }\n throw err\n }\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\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null\n }\n\n if (cacheEntry?.value?.kind !== CachedRouteKind.APP_ROUTE) {\n throw new Error(\n `Invariant: app-route received invalid cache entry ${cacheEntry?.value?.kind}`\n )\n }\n\n if (!isMinimalMode) {\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers)\n\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\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 (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n // @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 )\n return null\n }\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, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate,\n }),\n },\n silenceLog,\n routerServerContext\n )\n }\n\n // rethrow so that we can handle serving error page\n\n // If this is during static generation, throw the error again.\n if (isIsr) throw err\n\n // Otherwise, send a 500 response.\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(null, { status: 500 })\n )\n return null\n }\n}\n"],"names":["AppRouteRouteModule","RouteKind","patchFetch","_patchFetch","addRequestMeta","getRequestMeta","getTracer","SpanKind","setManifestsSingleton","normalizeAppPath","NodeNextRequest","NodeNextResponse","NextRequestAdapter","signalFromNodeResponse","BaseServerSpan","getRevalidateReason","sendResponse","fromNodeOutgoingHttpHeaders","toNodeOutgoingHttpHeaders","getCacheControlHeader","INFINITE_CACHE","NEXT_CACHE_TAGS_HEADER","NoFallbackError","CachedRouteKind","userland","routeModule","definition","kind","APP_ROUTE","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","resolvedPagePath","nextConfigOutput","workAsyncStorage","workUnitAsyncStorage","serverHooks","handler","req","res","ctx","isDev","hrtime","bigint","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","params","nextConfig","parsedUrl","isDraftMode","prerenderManifest","routerServerContext","isOnDemandRevalidate","revalidateOnlyGenerated","resolvedPathname","clientReferenceManifest","serverActionsManifest","normalizedSrcPage","isIsr","Boolean","dynamicRoutes","routes","render404","isPrerendered","prerenderInfo","fallback","experimental","adapterPath","cacheKey","supportsDynamicResponse","isStaticGeneration","method","tracer","activeSpan","getActiveScopeSpan","context","renderOpts","authInterrupts","cacheComponents","incrementalCache","cacheLifeProfiles","cacheLife","onClose","cb","on","onAfterTaskError","undefined","onInstrumentationRequestError","error","_request","errorContext","silenceLog","onRequestError","sharedContext","nodeNextReq","nodeNextRes","nextReq","fromNodeNextRequest","invokeRouteModule","span","handle","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","handleRequest","console","warn","route","name","updateName","isMinimalMode","MINIMAL_MODE","handleResponse","currentSpan","cacheEntry","responseGenerator","previousCacheEntry","setHeader","response","fetchMetrics","pendingWaitUntil","cacheTags","collectedTags","blob","headers","type","revalidate","collectedRevalidate","expire","collectedExpire","value","status","body","Buffer","from","arrayBuffer","cacheControl","err","isStale","routerKind","routePath","routeType","revalidateReason","routeKind","isFallback","isRoutePPREnabled","Error","isMiss","delete","getHeader","set","Response","withPropagatedContext","trace","spanName","SERVER","attributes","url"],"mappings":"uCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEO,SAAS,IAEd,IAAM,EAAU,QAAQ,GAAG,CAAC,OAAO,QAE/B,AAAJ,EAES,EAAA,KAFI,EAEA,CAAC,OAAO,CAAC,GAKf,QAAQ,GAAG,EACpB,kvCCdA,IAAA,EAAA,EAAA,CAAA,CAAA,OAKA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA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,SAAU,CAAA,EAAGrF,EAAO,CAAC,EAAEtC,EAAAA,CAAS,CAChCxB,KAAMpB,EAAAA,QAAAA,CAASwK,MAAM,CACrBC,WAAY,CACV,cAAevF,EACf,cAAe5C,EAAIoI,GAAG,AACxB,CACF,EACA7C,GAIR,CAAE,MAAOyB,EAAK,CAuBZ,GAtBMA,aAAevI,EAAAA,eAAc,EAEjC,CAFqC,KAE/BG,EAAYqF,cAAc,CAC9BjE,EACAgH,EACA,CACEE,WAAY,aACZC,UAAWrF,EACXsF,UAAW,QACXC,iBAAAA,CAAAA,EAAkBnJ,EAAAA,mBAAAA,EAAoB,oBACpCyE,uBACAlB,CACF,EACF,GACAuC,AAbiB,EAcjBxC,GAOAO,EAAO,MAAMiF,EAQjB,OALA,MAAA,CAAA,EAAM7I,EAAAA,YAAAA,EACJgG,EACAC,EACA,IAAI0D,SAAS,KAAM,CAAEpB,OAAQ,GAAI,IAE5B,IACT,CACF","ignoreList":[4]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports=[22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},45678,e=>{"use strict";var t=e.i(14747);function r(){let e=process.env.PI_ROOT;return e?t.default.resolve(e):process.cwd()}e.s(["getProjectRoot",()=>r])},59291,e=>e.a(async(t,r)=>{try{let t=await e.y("@mariozechner/pi-coding-agent-fd851c154169d599");e.n(t),r()}catch(e){r(e)}},!0),18242,e=>e.a(async(t,r)=>{try{let t=await e.y("@mariozechner/pi-ai-48e4ee29412715d1");e.n(t),r()}catch(e){r(e)}},!0),3202,e=>e.a(async(t,r)=>{try{var n=e.i(59291),a=e.i(18242),s=e.i(14747),o=e.i(22734),i=e.i(45678),l=t([n,a]);[n,a]=l.then?(await l)():l;let d=[{name:"web_search",description:"Search the web for information using Exa AI",parameters:{type:"object",properties:{query:{type:"string",description:"Search query"},numResults:{type:"number",description:"Number of results (default: 5)"}},required:["query"]}},{name:"web_fetch",description:"Fetch content from a specific URL",parameters:{type:"object",properties:{url:{type:"string",description:"URL to fetch"}},required:["url"]}}];async function c(e={}){let{sessionDir:t=s.join((0,i.getProjectRoot)(),".sessions"),sessionFile:r=s.join(t,"research-agent.jsonl"),modelId:l="openrouter/free",thinkingLevel:p="low"}=e;o.mkdirSync(t,{recursive:!0});let h=(0,a.getModel)("openrouter",l),{session:g}=await (0,n.createAgentSession)({model:h,thinkingLevel:p,systemPrompt:u,sessionManager:n.SessionManager.open(r),customTools:d});return g.agent.streamFn,g.agent.streamFn=(e,t,r)=>(0,a.streamSimple)(e,t,{...r,headers:{...r?.headers,"X-Title":"NextPi Agent","HTTP-Referer":"https://github.com/drewsepsi/nextpi"}}),g}let u=`You are NextPi, an expert research and coding assistant. You have access to the web and the local file system.
|
|
2
|
+
|
|
3
|
+
### GUIDELINES
|
|
4
|
+
- ALWAYS start by explaining your plan to the user in the main message or thinking block.
|
|
5
|
+
- BEFORE calling any tool that modifies the file system (write_file, edit_file, etc.), you MUST describe the specific changes you are about to make and why.
|
|
6
|
+
- If you are editing a file, summarize the intended changes first.
|
|
7
|
+
- If you are researching, explain what you hope to find.
|
|
8
|
+
|
|
9
|
+
### CAPABILITIES
|
|
10
|
+
1. **Web Search**: Search for docs, errors, news, etc.
|
|
11
|
+
2. **Web Fetch**: Read specific URLs.
|
|
12
|
+
3. **File Operations**: Read, write, list (ls), and edit files.
|
|
13
|
+
4. **Shell**: Execute bash commands for testing or exploration.
|
|
14
|
+
|
|
15
|
+
Always be surgical with edits and transparent with your process.`;e.s(["createResearchAgent",()=>c]),r()}catch(e){r(e)}},!1),23202,e=>e.a(async(t,r)=>{try{let i;var n=e.i(3202),a=t([n]);[n]=a.then?(await a)():a;let l=globalThis;async function s(){return l._sharedSession?l._sharedSession:(l._sharedSessionPromise||(console.log(`[Agent] Initializing new shared session singleton (Model: ${i||"default"})...`),l._sharedSessionPromise=(0,n.createResearchAgent)({modelId:i}).then(e=>(l._sharedSession=e,console.log("[Agent] Shared session initialized"),e))),l._sharedSessionPromise)}function o(e){console.log(`[Agent] Resetting shared session${e?` to model ${e}`:""}...`),e&&(i=e),l._sharedSession=void 0,l._sharedSessionPromise=void 0}e.s(["getSharedSession",()=>s,"resetSharedSession",()=>o]),r()}catch(e){r(e)}},!1),9738,e=>e.a(async(t,r)=>{try{var n=e.i(23202),a=t([n]);async function s(){let e,t=await (0,n.getSharedSession)();console.log(`[SSE] Client connected. Session ID: ${t.sessionId}`);let r=new TextEncoder,a=new ReadableStream({start(n){n.enqueue(r.encode(`data: ${JSON.stringify({type:"connected"})}
|
|
16
|
+
|
|
17
|
+
`)),e=t.subscribe(e=>{let a=function(e){switch(e.type){case"agent_start":return{type:"start"};case"agent_end":return{type:"end"};case"message_update":{let t=e.assistantMessageEvent;if("text_delta"===t.type)return{type:"content",content:t.delta};if("thinking_delta"===t.type)return{type:"thinking",content:t.delta};return null}case"tool_execution_start":return{type:"tool_start",tool:e.toolName,args:e.args};case"tool_execution_end":{let t="";return Array.isArray(e.result?.content)&&(t=e.result.content.filter(e=>"text"===e.type).map(e=>e.text??"").join("")),{type:"tool_end",tool:e.toolName,isError:e.isError,output:t.slice(0,2e3),error:e.isError?e.result?.error??"":""}}case"compaction_start":return{type:"compacting"};case"auto_retry_start":return{type:"retry",attempt:e.attempt,maxAttempts:e.maxAttempts,delayMs:e.delayMs};default:return null}}(e);if(null!==a){console.log(`[SSE] Emitting event: ${a.type} for session ${t.sessionId}`);try{n.enqueue(r.encode(`data: ${JSON.stringify(a)}
|
|
18
|
+
|
|
19
|
+
`))}catch(e){console.log("[SSE] Enqueue failed (likely client disconnected)")}}})},cancel(){console.log(`[SSE] Client disconnected. Session ID: ${t.sessionId}`),e?.()}});return new Response(a,{headers:{"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})}[n]=a.then?(await a)():a,e.s(["GET",()=>s]),r()}catch(e){r(e)}},!1),61994,e=>e.a(async(t,r)=>{try{var n=e.i(29662),a=e.i(58683),s=e.i(28986),o=e.i(97570),i=e.i(179),l=e.i(11773),c=e.i(4889),d=e.i(84191),u=e.i(23718),p=e.i(35879),h=e.i(80305),g=e.i(16854),y=e.i(75719),m=e.i(14940),f=e.i(8112),x=e.i(93695);e.i(70635);var R=e.i(20150),w=e.i(9738),v=t([w]);[w]=v.then?(await v)():v;let b=new n.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/stream/route",pathname:"/api/stream",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/picode/nextpi/app/api/stream/route.ts",nextConfigOutput:"",userland:w}),{workAsyncStorage:A,workUnitAsyncStorage:_,serverHooks:C}=b;function E(){return(0,s.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:_})}async function S(e,t,r){b.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let n="/api/stream/route";n=n.replace(/\/index$/,"")||"/";let s=await b.prepare(e,t,{srcPage:n,multiZoneDraftMode:!1});if(!s)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:w,params:v,nextConfig:E,parsedUrl:S,isDraftMode:A,prerenderManifest:_,routerServerContext:C,isOnDemandRevalidate:P,revalidateOnlyGenerated:T,resolvedPathname:I,clientReferenceManifest:N,serverActionsManifest:q}=s,k=(0,c.normalizeAppPath)(n),O=!!(_.dynamicRoutes[k]||_.routes[I]),j=async()=>((null==C?void 0:C.render404)?await C.render404(e,t,S,!1):t.end("This page could not be found"),null);if(O&&!A){let e=!!_.routes[I],t=_.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(E.experimental.adapterPath)return await j();throw new x.NoFallbackError}}let U=null;!O||b.isDev||A||(U=I,U="/index"===U?"/":U);let M=!0===b.isDev||!O,H=O&&!M;q&&N&&(0,l.setManifestsSingleton)({page:n,clientReferenceManifest:N,serverActionsManifest:q});let $=e.method||"GET",D=(0,i.getTracer)(),F=D.getActiveScopeSpan(),L={params:v,prerenderManifest:_,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:(0,o.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:E.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>b.onRequestError(e,t,n,a,C)},sharedContext:{buildId:w}},B=new d.NodeNextRequest(e),K=new d.NodeNextResponse(t),z=u.NextRequestAdapter.fromNodeNextRequest(B,(0,u.signalFromNodeResponse)(t));try{let s=async e=>b.handle(z,L).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 a=r.get("next.route");if(a){let t=`${$} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${$} ${n}`)}),l=!!(0,o.getRequestMeta)(e,"minimalMode"),c=async o=>{var i,c;let d=async({previousCacheEntry:a})=>{try{if(!l&&P&&T&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await s(o);e.fetchMetrics=L.renderOpts.fetchMetrics;let i=L.renderOpts.pendingWaitUntil;i&&r.waitUntil&&(r.waitUntil(i),i=void 0);let c=L.renderOpts.collectedTags;if(!O)return await (0,g.sendResponse)(B,K,n,L.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,y.toNodeOutgoingHttpHeaders)(n.headers);c&&(t[f.NEXT_CACHE_TAGS_HEADER]=c),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,a=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=f.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==a?void 0:a.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:n,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:P})},!1,C),t}},u=await b.handleResponse({req:e,nextConfig:E,cacheKey:U,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:P,revalidateOnlyGenerated:T,responseGenerator:d,waitUntil:r.waitUntil,isMinimalMode:l});if(!O)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(c=u.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});l||t.setHeader("x-nextjs-cache",P?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,y.fromNodeOutgoingHttpHeaders)(u.value.headers);return l&&O||p.delete(f.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,m.getCacheControlHeader)(u.cacheControl)),await (0,g.sendResponse)(B,K,new Response(u.value.body,{headers:p,status:u.value.status||200})),null};F?await c(F):await D.withPropagatedContext(e.headers,()=>D.trace(p.BaseServerSpan.handleRequest,{spanName:`${$} ${n}`,kind:i.SpanKind.SERVER,attributes:{"http.method":$,"http.target":e.url}},c))}catch(t){if(t instanceof x.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:P})},!1,C),O)throw t;return await (0,g.sendResponse)(B,K,new Response(null,{status:500})),null}}e.s(["handler",()=>S,"patchFetch",()=>E,"routeModule",()=>b,"serverHooks",()=>C,"workAsyncStorage",()=>A,"workUnitAsyncStorage",()=>_]),r()}catch(e){r(e)}},!1)];
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__bc57ef5b._.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../picode/nextpi/lib/root-path.ts","../../../../../picode/nextpi/lib/agent.ts","../../../../../picode/nextpi/lib/session-singleton.ts","../../../../../picode/nextpi/app/api/stream/route.ts","../../../../../picode/nextpi/node_modules/next/src/build/templates/app-route.ts"],"sourcesContent":["import path from 'path';\n\nexport function getProjectRoot() {\n // PI_ROOT can be set via environment variable to override the root directory\n const envRoot = process.env.PI_ROOT;\n \n if (envRoot) {\n // Resolve the path to handle relative paths from where the process was started\n return path.resolve(envRoot);\n }\n\n // If no PI_ROOT is set, fallback to process.cwd()\n // Note: in a Next.js environment during dev/build, process.cwd() is the project root.\n return process.cwd();\n}\n","import { \n createAgentSession, \n SessionManager, \n type AgentSession \n} from \"@mariozechner/pi-coding-agent\";\nimport { getModel, streamSimple } from \"@mariozechner/pi-ai\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\nimport { getProjectRoot } from \"./root-path\";\nimport { getEffectiveApiKey } from \"./config\";\n\nexport interface ResearchAgentConfig {\n sessionDir?: string;\n sessionFile?: string;\n modelId?: string;\n thinkingLevel?: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n}\n\n// Default OpenRouter model\nconst DEFAULT_MODEL = \"openrouter/free\";\n\n// Research tools (web search, web fetch)\nconst researchTools = [\n {\n name: \"web_search\",\n description: \"Search the web for information using Exa AI\",\n parameters: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n numResults: { type: \"number\", description: \"Number of results (default: 5)\" }\n },\n required: [\"query\"]\n }\n },\n {\n name: \"web_fetch\",\n description: \"Fetch content from a specific URL\",\n parameters: {\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" }\n },\n required: [\"url\"]\n }\n }\n];\n\nexport async function createResearchAgent(\n config: ResearchAgentConfig = {}\n): Promise<AgentSession> {\n const {\n sessionDir = path.join(getProjectRoot(), \".sessions\"),\n sessionFile = path.join(sessionDir, \"research-agent.jsonl\"),\n modelId = DEFAULT_MODEL,\n thinkingLevel = \"low\",\n } = config;\n\n // Ensure session directory exists\n fs.mkdirSync(sessionDir, { recursive: true });\n\n // Use OpenRouter model\n const model = getModel(\"openrouter\", modelId as \"openrouter/free\");\n\n // Create session with research tools and system prompt\n const { session } = await createAgentSession({\n model,\n thinkingLevel,\n systemPrompt: RESEARCH_SYSTEM_PROMPT,\n sessionManager: SessionManager.open(sessionFile),\n customTools: researchTools as any,\n } as any);\n\n // Wrap stream function with OpenRouter headers\n const originalStreamFn = session.agent.streamFn;\n session.agent.streamFn = (model, context, options) => {\n return streamSimple(model, context, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-Title\": \"NextPi Agent\",\n \"HTTP-Referer\": \"https://github.com/drewsepsi/nextpi\",\n },\n });\n };\n\n return session;\n}\n\n// System prompt for research and coding\nexport const RESEARCH_SYSTEM_PROMPT = `You are NextPi, an expert research and coding assistant. You have access to the web and the local file system.\n\n### GUIDELINES\n- ALWAYS start by explaining your plan to the user in the main message or thinking block.\n- BEFORE calling any tool that modifies the file system (write_file, edit_file, etc.), you MUST describe the specific changes you are about to make and why.\n- If you are editing a file, summarize the intended changes first.\n- If you are researching, explain what you hope to find.\n\n### CAPABILITIES\n1. **Web Search**: Search for docs, errors, news, etc.\n2. **Web Fetch**: Read specific URLs.\n3. **File Operations**: Read, write, list (ls), and edit files.\n4. **Shell**: Execute bash commands for testing or exploration.\n\nAlways be surgical with edits and transparent with your process.`;\n","import { createResearchAgent } from '@/lib/agent';\n\ntype AgentSession = Awaited<ReturnType<typeof createResearchAgent>>;\n\n/**\n * In Next.js development mode, modules are frequently re-evaluated due to HMR.\n * Attaching the session to `globalThis` ensures that all API routes (which may\n * be running in different contexts or re-evaluated modules) share exactly\n * the same AgentSession instance.\n */\nconst globalForAgent = globalThis as unknown as {\n _sharedSession?: AgentSession;\n _sharedSessionPromise?: Promise<AgentSession>;\n};\n\nlet currentModelId: string | undefined = undefined;\n\nexport async function getSharedSession(): Promise<AgentSession> {\n // Return the existing session if already initialized\n if (globalForAgent._sharedSession) {\n return globalForAgent._sharedSession;\n }\n\n // If a session is being created, wait for it\n if (globalForAgent._sharedSessionPromise) {\n return globalForAgent._sharedSessionPromise;\n }\n\n // Otherwise, create a new session and store the promise globally\n console.log(`[Agent] Initializing new shared session singleton (Model: ${currentModelId || 'default'})...`);\n globalForAgent._sharedSessionPromise = createResearchAgent({ modelId: currentModelId }).then((session) => {\n globalForAgent._sharedSession = session;\n console.log('[Agent] Shared session initialized');\n return session;\n });\n\n return globalForAgent._sharedSessionPromise;\n}\n\nexport function resetSharedSession(modelId?: string): void {\n console.log(`[Agent] Resetting shared session${modelId ? ` to model ${modelId}` : ''}...`);\n if (modelId) {\n currentModelId = modelId;\n }\n globalForAgent._sharedSession = undefined;\n globalForAgent._sharedSessionPromise = undefined;\n}\n\n","import { getSharedSession } from '@/lib/session-singleton';\nimport type { AgentSessionEvent } from '@mariozechner/pi-coding-agent';\n\nfunction translateEvent(event: AgentSessionEvent): { type: string; [key: string]: any } | null {\n switch (event.type) {\n case 'agent_start': return { type: 'start' };\n case 'agent_end': return { type: 'end' };\n case 'message_update': {\n const ae = event.assistantMessageEvent;\n if (ae.type === 'text_delta') return { type: 'content', content: ae.delta };\n if (ae.type === 'thinking_delta') return { type: 'thinking', content: ae.delta };\n return null;\n }\n case 'tool_execution_start':\n return { type: 'tool_start', tool: event.toolName, args: event.args };\n case 'tool_execution_end': {\n let output = '';\n if (Array.isArray(event.result?.content)) {\n output = (event.result.content as any[])\n .filter((c) => c.type === 'text')\n .map((c) => c.text ?? '')\n .join('');\n }\n return {\n type: 'tool_end',\n tool: event.toolName,\n isError: event.isError,\n output: output.slice(0, 2000),\n error: event.isError ? (event.result?.error ?? '') : '',\n };\n }\n case 'compaction_start': return { type: 'compacting' };\n case 'auto_retry_start':\n return { type: 'retry', attempt: event.attempt, maxAttempts: event.maxAttempts, delayMs: event.delayMs };\n default: return null;\n }\n}\n\nexport async function GET() {\n const agentSession = await getSharedSession();\n console.log(`[SSE] Client connected. Session ID: ${agentSession.sessionId}`);\n\n const encoder = new TextEncoder();\n let unsubscribe: (() => void) | undefined;\n\n const stream = new ReadableStream({\n start(controller) {\n controller.enqueue(encoder.encode(`data: ${JSON.stringify({ type: 'connected' })}\\n\\n`));\n\n unsubscribe = agentSession.subscribe((event: AgentSessionEvent) => {\n const translated = translateEvent(event);\n if (translated !== null) {\n console.log(`[SSE] Emitting event: ${translated.type} for session ${agentSession.sessionId}`);\n try {\n controller.enqueue(encoder.encode(`data: ${JSON.stringify(translated)}\\n\\n`));\n } catch (err) {\n console.log(`[SSE] Enqueue failed (likely client disconnected)`);\n }\n }\n });\n },\n cancel() {\n console.log(`[SSE] Client disconnected. Session ID: ${agentSession.sessionId}`);\n unsubscribe?.();\n },\n });\n\n return new Response(stream, {\n headers: {\n 'Content-Type': 'text/event-stream; charset=utf-8',\n 'Cache-Control': 'no-cache, no-transform',\n 'Connection': 'keep-alive',\n 'X-Accel-Buffering': 'no',\n },\n });\n}\n","import {\n AppRouteRouteModule,\n type AppRouteRouteHandlerContext,\n type AppRouteRouteModuleOptions,\n} from '../../server/route-modules/app-route/module.compiled'\nimport { RouteKind } from '../../server/route-kind'\nimport { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { addRequestMeta, getRequestMeta } from '../../server/request-meta'\nimport { getTracer, type Span, SpanKind } from '../../server/lib/trace/tracer'\nimport { setManifestsSingleton } from '../../server/app-render/manifests-singleton'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { sendResponse } from '../../server/send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n toNodeOutgoingHttpHeaders,\n} from '../../server/web/utils'\nimport { getCacheControlHeader } from '../../server/lib/cache-control'\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\nimport {\n CachedRouteKind,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\n\nimport * as userland from 'VAR_USERLAND'\n\n// These are injected by the loader afterwards. This is injected as a variable\n// instead of a replacement because this could also be `undefined` instead of\n// an empty string.\ndeclare const nextConfigOutput: AppRouteRouteModuleOptions['nextConfigOutput']\n\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\n// INJECT:nextConfigOutput\n\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n filename: 'VAR_DEFINITION_FILENAME',\n bundlePath: 'VAR_DEFINITION_BUNDLE_PATH',\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',\n nextConfigOutput,\n userland,\n})\n\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule\n\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage,\n })\n}\n\nexport {\n routeModule,\n workAsyncStorage,\n workUnitAsyncStorage,\n serverHooks,\n patchFetch,\n}\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint())\n }\n let srcPage = 'VAR_DEFINITION_PAGE'\n\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\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n params,\n nextConfig,\n parsedUrl,\n isDraftMode,\n prerenderManifest,\n routerServerContext,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n resolvedPathname,\n clientReferenceManifest,\n serverActionsManifest,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let isIsr = Boolean(\n prerenderManifest.dynamicRoutes[normalizedSrcPage] ||\n prerenderManifest.routes[resolvedPathname]\n )\n\n const render404 = async () => {\n // TODO: should route-module itself handle rendering the 404\n if (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\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname])\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n\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\n let cacheKey: string | null = null\n\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\n const supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr\n\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\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\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n const context: AppRouteRouteHandlerContext = {\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: (\n error,\n _request,\n errorContext,\n silenceLog\n ) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n silenceLog,\n routerServerContext\n ),\n },\n sharedContext: {\n buildId,\n },\n }\n const nodeNextReq = new NodeNextRequest(req)\n const nodeNextRes = new NodeNextResponse(res)\n\n const nextReq = NextRequestAdapter.fromNodeNextRequest(\n nodeNextReq,\n signalFromNodeResponse(res)\n )\n\n try {\n const invokeRouteModule = async (span?: Span) => {\n return routeModule.handle(nextReq, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\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\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\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(\n process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode')\n )\n\n const handleResponse = async (currentSpan?: Span) => {\n const responseGenerator: ResponseGenerator = async ({\n previousCacheEntry,\n }) => {\n try {\n if (\n !isMinimalMode &&\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry\n ) {\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\n const response = await invokeRouteModule(currentSpan)\n\n ;(req as any).fetchMetrics = (context.renderOpts as any).fetchMetrics\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\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\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\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n }\n\n return cacheEntry\n } else {\n // send response without caching if not ISR\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n response,\n context.renderOpts.pendingWaitUntil\n )\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?.isStale) {\n const silenceLog = false\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate,\n }),\n },\n silenceLog,\n routerServerContext\n )\n }\n throw err\n }\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\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null\n }\n\n if (cacheEntry?.value?.kind !== CachedRouteKind.APP_ROUTE) {\n throw new Error(\n `Invariant: app-route received invalid cache entry ${cacheEntry?.value?.kind}`\n )\n }\n\n if (!isMinimalMode) {\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers)\n\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\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 (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n // @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 )\n return null\n }\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, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate,\n }),\n },\n silenceLog,\n routerServerContext\n )\n }\n\n // rethrow so that we can handle serving error page\n\n // If this is during static generation, throw the error again.\n if (isIsr) throw err\n\n // Otherwise, send a 500 response.\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(null, { status: 500 })\n )\n return null\n }\n}\n"],"names":["AppRouteRouteModule","RouteKind","patchFetch","_patchFetch","addRequestMeta","getRequestMeta","getTracer","SpanKind","setManifestsSingleton","normalizeAppPath","NodeNextRequest","NodeNextResponse","NextRequestAdapter","signalFromNodeResponse","BaseServerSpan","getRevalidateReason","sendResponse","fromNodeOutgoingHttpHeaders","toNodeOutgoingHttpHeaders","getCacheControlHeader","INFINITE_CACHE","NEXT_CACHE_TAGS_HEADER","NoFallbackError","CachedRouteKind","userland","routeModule","definition","kind","APP_ROUTE","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","resolvedPagePath","nextConfigOutput","workAsyncStorage","workUnitAsyncStorage","serverHooks","handler","req","res","ctx","isDev","hrtime","bigint","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","params","nextConfig","parsedUrl","isDraftMode","prerenderManifest","routerServerContext","isOnDemandRevalidate","revalidateOnlyGenerated","resolvedPathname","clientReferenceManifest","serverActionsManifest","normalizedSrcPage","isIsr","Boolean","dynamicRoutes","routes","render404","isPrerendered","prerenderInfo","fallback","experimental","adapterPath","cacheKey","supportsDynamicResponse","isStaticGeneration","method","tracer","activeSpan","getActiveScopeSpan","context","renderOpts","authInterrupts","cacheComponents","incrementalCache","cacheLifeProfiles","cacheLife","onClose","cb","on","onAfterTaskError","undefined","onInstrumentationRequestError","error","_request","errorContext","silenceLog","onRequestError","sharedContext","nodeNextReq","nodeNextRes","nextReq","fromNodeNextRequest","invokeRouteModule","span","handle","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","handleRequest","console","warn","route","name","updateName","isMinimalMode","MINIMAL_MODE","handleResponse","currentSpan","cacheEntry","responseGenerator","previousCacheEntry","setHeader","response","fetchMetrics","pendingWaitUntil","cacheTags","collectedTags","blob","headers","type","revalidate","collectedRevalidate","expire","collectedExpire","value","status","body","Buffer","from","arrayBuffer","cacheControl","err","isStale","routerKind","routePath","routeType","revalidateReason","routeKind","isFallback","isRoutePPREnabled","Error","isMiss","delete","getHeader","set","Response","withPropagatedContext","trace","spanName","SERVER","attributes","url"],"mappings":"qzBAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEO,SAAS,IAEd,IAAM,EAAU,QAAQ,GAAG,CAAC,OAAO,QAEnC,AAAI,EAEK,EAAA,KAFI,EAEA,CAAC,OAAO,CAAC,GAKf,QAAQ,GAAG,EACpB,iTCdA,IAAA,EAAA,EAAA,CAAA,CAAA,OAKA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,6CAcA,IAAM,EAAgB,CACpB,CACE,KAAM,aACN,YAAa,8CACb,WAAY,CACV,KAAM,SACN,WAAY,CACV,MAAO,CAAE,KAAM,SAAU,YAAa,cAAe,EACrD,WAAY,CAAE,KAAM,SAAU,YAAa,gCAAiC,CAC9E,EACA,SAAU,CAAC,QAAQ,AACrB,CACF,EACA,CACE,KAAM,YACN,YAAa,oCACb,WAAY,CACV,KAAM,SACN,WAAY,CACV,IAAK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XsF,UAAW,QACXC,iBAAAA,CAAAA,EAAkBnJ,EAAAA,mBAAAA,EAAoB,oBACpCyE,uBACAlB,CACF,EACF,GACAuC,AAbiB,EAcjBxC,GAOAO,EAAO,MAAMiF,EAQjB,OALA,MAAA,CAAA,EAAM7I,EAAAA,YAAAA,EACJgG,EACAC,EACA,IAAI0D,SAAS,KAAM,CAAEpB,OAAQ,GAAI,IAE5B,IACT,CACF","ignoreList":[4]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports=[45678,e=>{"use strict";var t=e.i(14747);function r(){let e=process.env.PI_ROOT;return e?t.default.resolve(e):process.cwd()}e.s(["getProjectRoot",()=>r])},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},59291,e=>e.a(async(t,r)=>{try{let t=await e.y("@mariozechner/pi-coding-agent-fd851c154169d599");e.n(t),r()}catch(e){r(e)}},!0),18242,e=>e.a(async(t,r)=>{try{let t=await e.y("@mariozechner/pi-ai-48e4ee29412715d1");e.n(t),r()}catch(e){r(e)}},!0),3202,e=>e.a(async(t,r)=>{try{var s=e.i(59291),a=e.i(18242),n=e.i(14747),o=e.i(22734),i=e.i(45678),l=t([s,a]);[s,a]=l.then?(await l)():l;let d=[{name:"web_search",description:"Search the web for information using Exa AI",parameters:{type:"object",properties:{query:{type:"string",description:"Search query"},numResults:{type:"number",description:"Number of results (default: 5)"}},required:["query"]}},{name:"web_fetch",description:"Fetch content from a specific URL",parameters:{type:"object",properties:{url:{type:"string",description:"URL to fetch"}},required:["url"]}}];async function c(e={}){let{sessionDir:t=n.join((0,i.getProjectRoot)(),".sessions"),sessionFile:r=n.join(t,"research-agent.jsonl"),modelId:l="openrouter/free",thinkingLevel:p="low"}=e;o.mkdirSync(t,{recursive:!0});let h=(0,a.getModel)("openrouter",l),{session:g}=await (0,s.createAgentSession)({model:h,thinkingLevel:p,systemPrompt:u,sessionManager:s.SessionManager.open(r),customTools:d});return g.agent.streamFn,g.agent.streamFn=(e,t,r)=>(0,a.streamSimple)(e,t,{...r,headers:{...r?.headers,"X-Title":"NextPi Agent","HTTP-Referer":"https://github.com/drewsepsi/nextpi"}}),g}let u=`You are NextPi, an expert research and coding assistant. You have access to the web and the local file system.
|
|
2
|
+
|
|
3
|
+
### GUIDELINES
|
|
4
|
+
- ALWAYS start by explaining your plan to the user in the main message or thinking block.
|
|
5
|
+
- BEFORE calling any tool that modifies the file system (write_file, edit_file, etc.), you MUST describe the specific changes you are about to make and why.
|
|
6
|
+
- If you are editing a file, summarize the intended changes first.
|
|
7
|
+
- If you are researching, explain what you hope to find.
|
|
8
|
+
|
|
9
|
+
### CAPABILITIES
|
|
10
|
+
1. **Web Search**: Search for docs, errors, news, etc.
|
|
11
|
+
2. **Web Fetch**: Read specific URLs.
|
|
12
|
+
3. **File Operations**: Read, write, list (ls), and edit files.
|
|
13
|
+
4. **Shell**: Execute bash commands for testing or exploration.
|
|
14
|
+
|
|
15
|
+
Always be surgical with edits and transparent with your process.`;e.s(["createResearchAgent",()=>c]),r()}catch(e){r(e)}},!1),23202,e=>e.a(async(t,r)=>{try{let i;var s=e.i(3202),a=t([s]);[s]=a.then?(await a)():a;let l=globalThis;async function n(){return l._sharedSession?l._sharedSession:(l._sharedSessionPromise||(console.log(`[Agent] Initializing new shared session singleton (Model: ${i||"default"})...`),l._sharedSessionPromise=(0,s.createResearchAgent)({modelId:i}).then(e=>(l._sharedSession=e,console.log("[Agent] Shared session initialized"),e))),l._sharedSessionPromise)}function o(e){console.log(`[Agent] Resetting shared session${e?` to model ${e}`:""}...`),e&&(i=e),l._sharedSession=void 0,l._sharedSessionPromise=void 0}e.s(["getSharedSession",()=>n,"resetSharedSession",()=>o]),r()}catch(e){r(e)}},!1),1307,e=>e.a(async(t,r)=>{try{var s=e.i(69218),a=e.i(23202),n=t([a]);async function o(){try{let e=await (0,a.getSharedSession)(),t=e.messages.reduce((e,t)=>{let r="";return"user"===t.role?"string"==typeof t.content?r=t.content:Array.isArray(t.content)&&(r=t.content.map(e=>"text"===e.type?e.text:"").join("")):"assistant"===t.role?r=t.content.map(e=>"text"===e.type?e.text:"").join(""):"toolResult"===t.role&&(r=t.content.map(e=>"text"===e.type?e.text:"").join("")),e+Math.ceil(r.length/4)},0);return s.NextResponse.json({model:e.model?.id,messages:e.messages.length,tokens:t,tools:e.getActiveToolNames()})}catch(e){return s.NextResponse.json({error:e.message},{status:500})}}async function i(e){try{let{modelId:t}=await e.json().catch(()=>({}));(0,a.resetSharedSession)(t);let r=await (0,a.getSharedSession)();return s.NextResponse.json({success:!0,sessionId:r.sessionId})}catch(e){return s.NextResponse.json({error:e.message},{status:500})}}[a]=n.then?(await n)():n,e.s(["GET",()=>o,"POST",()=>i]),r()}catch(e){r(e)}},!1),75612,e=>e.a(async(t,r)=>{try{var s=e.i(29662),a=e.i(58683),n=e.i(28986),o=e.i(97570),i=e.i(179),l=e.i(11773),c=e.i(4889),d=e.i(84191),u=e.i(23718),p=e.i(35879),h=e.i(80305),g=e.i(16854),m=e.i(75719),x=e.i(14940),f=e.i(8112),y=e.i(93695);e.i(70635);var R=e.i(20150),w=e.i(1307),v=t([w]);[w]=v.then?(await v)():v;let b=new s.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/session/route",pathname:"/api/session",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/picode/nextpi/app/api/session/route.ts",nextConfigOutput:"",userland:w}),{workAsyncStorage:A,workUnitAsyncStorage:C,serverHooks:P}=b;function S(){return(0,n.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:C})}async function E(e,t,r){b.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let s="/api/session/route";s=s.replace(/\/index$/,"")||"/";let n=await b.prepare(e,t,{srcPage:s,multiZoneDraftMode:!1});if(!n)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:w,params:v,nextConfig:S,parsedUrl:E,isDraftMode:A,prerenderManifest:C,routerServerContext:P,isOnDemandRevalidate:T,revalidateOnlyGenerated:_,resolvedPathname:j,clientReferenceManifest:N,serverActionsManifest:I}=n,k=(0,c.normalizeAppPath)(s),q=!!(C.dynamicRoutes[k]||C.routes[j]),O=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,E,!1):t.end("This page could not be found"),null);if(q&&!A){let e=!!C.routes[j],t=C.dynamicRoutes[k];if(t&&!1===t.fallback&&!e){if(S.experimental.adapterPath)return await O();throw new y.NoFallbackError}}let U=null;!q||b.isDev||A||(U=j,U="/index"===U?"/":U);let H=!0===b.isDev||!q,M=q&&!H;I&&N&&(0,l.setManifestsSingleton)({page:s,clientReferenceManifest:N,serverActionsManifest:I});let D=e.method||"GET",F=(0,i.getTracer)(),$=F.getActiveScopeSpan(),L={params:v,prerenderManifest:C,renderOpts:{experimental:{authInterrupts:!!S.experimental.authInterrupts},cacheComponents:!!S.cacheComponents,supportsDynamicResponse:H,incrementalCache:(0,o.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:S.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s,a)=>b.onRequestError(e,t,s,a,P)},sharedContext:{buildId:w}},K=new d.NodeNextRequest(e),B=new d.NodeNextResponse(t),z=u.NextRequestAdapter.fromNodeNextRequest(K,(0,u.signalFromNodeResponse)(t));try{let n=async e=>b.handle(z,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=F.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${D} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${D} ${s}`)}),l=!!(0,o.getRequestMeta)(e,"minimalMode"),c=async o=>{var i,c;let d=async({previousCacheEntry:a})=>{try{if(!l&&T&&_&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await n(o);e.fetchMetrics=L.renderOpts.fetchMetrics;let i=L.renderOpts.pendingWaitUntil;i&&r.waitUntil&&(r.waitUntil(i),i=void 0);let c=L.renderOpts.collectedTags;if(!q)return await (0,g.sendResponse)(K,B,s,L.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(s.headers);c&&(t[f.NEXT_CACHE_TAGS_HEADER]=c),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,a=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=f.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:a}}}}catch(t){throw(null==a?void 0:a.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:s,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:T})},!1,P),t}},u=await b.handleResponse({req:e,nextConfig:S,cacheKey:U,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:_,responseGenerator:d,waitUntil:r.waitUntil,isMinimalMode:l});if(!q)return null;if((null==u||null==(i=u.value)?void 0:i.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(c=u.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});l||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let p=(0,m.fromNodeOutgoingHttpHeaders)(u.value.headers);return l&&q||p.delete(f.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||p.get("Cache-Control")||p.set("Cache-Control",(0,x.getCacheControlHeader)(u.cacheControl)),await (0,g.sendResponse)(K,B,new Response(u.value.body,{headers:p,status:u.value.status||200})),null};$?await c($):await F.withPropagatedContext(e.headers,()=>F.trace(p.BaseServerSpan.handleRequest,{spanName:`${D} ${s}`,kind:i.SpanKind.SERVER,attributes:{"http.method":D,"http.target":e.url}},c))}catch(t){if(t instanceof y.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,h.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:T})},!1,P),q)throw t;return await (0,g.sendResponse)(K,B,new Response(null,{status:500})),null}}e.s(["handler",()=>E,"patchFetch",()=>S,"routeModule",()=>b,"serverHooks",()=>P,"workAsyncStorage",()=>A,"workUnitAsyncStorage",()=>C]),r()}catch(e){r(e)}},!1)];
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__be62c218._.js.map
|